Skip to content

Commit 76044da

Browse files
author
timlinux
committed
Fix for trying to call winmain instead of main when compiled with msvc. 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
1 parent b0a5642 commit 76044da

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ IF (WIN32)
146146
SET (QGIS_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include)
147147
SET (QGIS_SOURCE_DIR ${CMAKE_SOURCE_DIR})
148148
IF(MSVC)
149+
#tell msvc compiler to use main instead of winmain as the
150+
#application entry point
151+
SET(QT_USE_QTMAIN TRUE)
149152
# Turn on defines for non standard maths stuff
150153
ADD_DEFINITIONS(-D_USE_MATH_DEFINES)
151154

src/app/CMakeLists.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,21 @@ ENDIF (PYTHON_FOUND)
208208

209209
#############
210210

211-
ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS})
211+
IF (WIN32)
212+
ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS} WIN32)
213+
ELSEIF (WIN32)
214+
ADD_EXECUTABLE(qgis ${QGIS_APP_SRCS} ${QGIS_APP_MOC_SRCS})
215+
ENDIF (WIN32)
212216

213217
TARGET_LINK_LIBRARIES(qgis
214218
${QT_LIBRARIES}
215219
qgis_core
216220
qgis_gui
217221
)
222+
IF (MSVC)
223+
#This resolves issues like cant find winmain etc
224+
TARGET_LINK_LIBRARIES(qgis qtmain)
225+
ENDIF (MSVC)
218226

219227
SET_TARGET_PROPERTIES(qgis PROPERTIES
220228
INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib

0 commit comments

Comments
 (0)