Skip to content
Permalink
Browse files

Fix for trying to call winmain instead of main when compiled with msv…

…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@7256 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Oct 9, 2007
1 parent b9811d0 commit 2c717f77616d57cbe170376b29bf6429e5d89fd2
Showing with 12 additions and 1 deletion.
  1. +3 −0 CMakeLists.txt
  2. +9 −1 src/app/CMakeLists.txt
@@ -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)

@@ -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

0 comments on commit 2c717f7

Please sign in to comment.
You can’t perform that action at this time.