--- a/CMakeLists.txt Sat Jun 06 23:17:33 2015 +0300 +++ b/CMakeLists.txt Sun Jun 07 15:52:33 2015 +0300 @@ -1,10 +1,10 @@ project (zcinema) cmake_minimum_required (VERSION 2.6) +cmake_policy (SET CMP0020 NEW) if (USE_QT5) find_package (Qt5Widgets REQUIRED) find_package (Qt5Core REQUIRED) - set (CMAKE_AUTOMOC ON) else() find_package (Qt4 REQUIRED) endif() @@ -52,6 +52,12 @@ if (NOT MSVC) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall") +else() + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Za") +endif() + +if (MINGW) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -lpthread -static") endif() include_directories ("${PROJECT_BINARY_DIR}") @@ -64,7 +70,6 @@ add_library (${PROJECT_NAME}-common STATIC ${ZCINEMA_COMMON_SOURCES} - ${ZCINEMA_MOC} ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS}) else() @@ -74,13 +79,12 @@ add_library (${PROJECT_NAME}-common STATIC ${ZCINEMA_COMMON_SOURCES} - ${ZCINEMA_MOC} ${ZCINEMA_RCC} ${ZCINEMA_FORMS_HEADERS}) endif() -add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES}) -add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES}) +add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES} zcinema.rc) +add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES} zcinema.rc) if (USE_QT5) target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets) @@ -98,6 +102,8 @@ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_dependencies (${PROJECT_NAME}-common make_hginfo) +set_target_properties (${PROJECT_NAME} PROPERTIES AUTOMOC 1) +set_target_properties (${PROJECT_NAME}-config PROPERTIES AUTOMOC 1) # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword # which clang doesn't seem to like.