Skip to content

Commit

Permalink
Fix for trying to call winmain instead of main when compiled with msv…
Browse files Browse the repository at this point in the history
…c. Link to qtmain when building with msvc (fixes crash on app start up when building in release mode). Dont show console when building on win.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7256 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 9, 2007
1 parent b0a5642 commit 76044da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -146,6 +146,9 @@ IF (WIN32)
SET (QGIS_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
SET (QGIS_SOURCE_DIR ${CMAKE_SOURCE_DIR})
IF(MSVC)
#tell msvc compiler to use main instead of winmain as the
#application entry point
SET(QT_USE_QTMAIN TRUE)
# Turn on defines for non standard maths stuff
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)

Expand Down
10 changes: 9 additions & 1 deletion src/app/CMakeLists.txt
Expand Up @@ -208,13 +208,21 @@ ENDIF (PYTHON_FOUND)

#############

ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS})
IF (WIN32)
ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} WIN32)
ELSEIF (WIN32)
ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS})
ENDIF (WIN32)

TARGET_LINK_LIBRARIES(qgis
${QT_LIBRARIES}
qgis_core
qgis_gui
)
IF (MSVC)
#This resolves issues like cant find winmain etc
TARGET_LINK_LIBRARIES(qgis qtmain)
ENDIF (MSVC)

SET_TARGET_PROPERTIES(qgis PROPERTIES
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
Expand Down

0 comments on commit 76044da

Please sign in to comment.