summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorVitaly Svyastyn <protomors@gmail.com>2017-11-05 19:33:01 +0600
committerGeorge Hazan <ghazan@miranda.im>2017-11-05 16:33:01 +0300
commit52921a9e13484319df2d4f1153521f3f5e12b932 (patch)
tree5c6b99a6e59958778ab1cdfa61a0848d3211eb0a /cmake
parentdb6f3932affcc9397c9fbed99d344388a585add5 (diff)
More CMake (#1016)
* Generate version information before build. * Removed /EHsc from compile options. * CMake files for the rest of protocols. * CMake 64 bit build. * CMake: precompiled headers.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/core.cmake10
-rw-r--r--cmake/lib.cmake10
-rw-r--r--cmake/plugin.cmake10
3 files changed, 27 insertions, 3 deletions
diff --git a/cmake/core.cmake b/cmake/core.cmake
index 7c8677d4e1..5fc7c37302 100644
--- a/cmake/core.cmake
+++ b/cmake/core.cmake
@@ -1,6 +1,14 @@
include_directories(.)
file(GLOB SOURCES "src/*.h" "src/*.cpp" "res/*.rc")
-add_library(${TARGET} SHARED ${SOURCES})
+set(STDAFX "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.cxx")
+if ((EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.h") AND (EXISTS ${STDAFX}))
+ file(GLOB PRECOMPILED_SOURCES "src/*.cpp")
+ SET_SOURCE_FILES_PROPERTIES(${PRECOMPILED_SOURCES} PROPERTIES COMPILE_FLAGS "/Yu")
+ SET_SOURCE_FILES_PROPERTIES(${STDAFX} PROPERTIES COMPILE_FLAGS "/Yc")
+ add_library(${TARGET} SHARED ${STDAFX} ${SOURCES})
+else()
+ add_library(${TARGET} SHARED ${SOURCES})
+endif()
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "/SUBSYSTEM:WINDOWS"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/$<CONFIG>/Core"
diff --git a/cmake/lib.cmake b/cmake/lib.cmake
index 7c94c732e3..64ceb02bd5 100644
--- a/cmake/lib.cmake
+++ b/cmake/lib.cmake
@@ -1,4 +1,12 @@
-add_library(${TARGET} SHARED ${SOURCES})
+set(STDAFX "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.cxx")
+if ((EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.h") AND (EXISTS ${STDAFX}))
+ file(GLOB PRECOMPILED_SOURCES "src/*.cpp")
+ SET_SOURCE_FILES_PROPERTIES(${PRECOMPILED_SOURCES} PROPERTIES COMPILE_FLAGS "/Yu")
+ SET_SOURCE_FILES_PROPERTIES(${STDAFX} PROPERTIES COMPILE_FLAGS "/Yc")
+ add_library(${TARGET} SHARED ${STDAFX} ${SOURCES})
+else()
+ add_library(${TARGET} SHARED ${SOURCES})
+endif()
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "/SUBSYSTEM:WINDOWS"
SUFFIX ".mir"
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 9d3efac2e0..d3986c87c3 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -1,4 +1,12 @@
-add_library(${TARGET} SHARED ${SOURCES})
+set(STDAFX "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.cxx")
+if ((EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/stdafx.h") AND (EXISTS ${STDAFX}))
+ file(GLOB PRECOMPILED_SOURCES "src/*.cpp")
+ SET_SOURCE_FILES_PROPERTIES(${PRECOMPILED_SOURCES} PROPERTIES COMPILE_FLAGS "/Yu")
+ SET_SOURCE_FILES_PROPERTIES(${STDAFX} PROPERTIES COMPILE_FLAGS "/Yc")
+ add_library(${TARGET} SHARED ${STDAFX} ${SOURCES})
+else()
+ add_library(${TARGET} SHARED ${SOURCES})
+endif()
set_target_properties(${TARGET} PROPERTIES
LINK_FLAGS "/SUBSYSTEM:WINDOWS"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/$<CONFIG>/Plugins"