File tree Expand file tree Collapse file tree 6 files changed +76
-0
lines changed Expand file tree Collapse file tree 6 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,20 @@ option(
25
25
gtest_hide_internal_symbols
26
26
"Build gtest with internal symbols hidden in shared libraries."
27
27
OFF )
28
+
29
+ if (MSVC AND USE_STATIC_CRT )
30
+ set (CompilerFlags
31
+ CMAKE_CXX_FLAGS
32
+ CMAKE_CXX_FLAGS_DEBUG
33
+ CMAKE_CXX_FLAGS_RELEASE
34
+ CMAKE_C_FLAGS
35
+ CMAKE_C_FLAGS_DEBUG
36
+ CMAKE_C_FLAGS_RELEASE
37
+ )
38
+ foreach (CompilerFlag ${CompilerFlags} )
39
+ string (REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag} }" )
40
+ endforeach ()
41
+ endif ()
28
42
29
43
# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
30
44
include (cmake/hermetic_build.cmake OPTIONAL )
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ project(cpp-ipc)
3
3
4
4
option (LIBIPC_BUILD_TESTS "Build all of libipc's own tests." OFF )
5
5
option (LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF )
6
+ option (USE_STATIC_CRT "Set to ON to build with static CRT on Windows (/MT)." OFF )
6
7
7
8
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
8
9
set (CMAKE_CXX_STANDARD 17 )
@@ -13,8 +14,13 @@ endif()
13
14
14
15
set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR} /bin )
15
16
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR} /bin )
17
+
16
18
set (LIBIPC_PROJECT_DIR ${PROJECT_SOURCE_DIR} )
17
19
20
+
21
+ # Unicode Support
22
+ add_definitions (-DUNICODE -D_UNICODE )
23
+
18
24
add_subdirectory (src )
19
25
20
26
if (LIBIPC_BUILD_TESTS )
Original file line number Diff line number Diff line change 1
1
project (chat )
2
2
3
+ if (MSVC AND USE_STATIC_CRT )
4
+ set (CompilerFlags
5
+ CMAKE_CXX_FLAGS
6
+ CMAKE_CXX_FLAGS_DEBUG
7
+ CMAKE_CXX_FLAGS_RELEASE
8
+ CMAKE_C_FLAGS
9
+ CMAKE_C_FLAGS_DEBUG
10
+ CMAKE_C_FLAGS_RELEASE
11
+ )
12
+ foreach (CompilerFlag ${CompilerFlags} )
13
+ string (REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag} }" )
14
+ endforeach ()
15
+ endif ()
16
+
3
17
file (GLOB SRC_FILES ./*.cpp )
4
18
file (GLOB HEAD_FILES ./*.h )
5
19
Original file line number Diff line number Diff line change 1
1
project (msg_que )
2
2
3
+ if (MSVC AND USE_STATIC_CRT )
4
+ set (CompilerFlags
5
+ CMAKE_CXX_FLAGS
6
+ CMAKE_CXX_FLAGS_DEBUG
7
+ CMAKE_CXX_FLAGS_RELEASE
8
+ CMAKE_C_FLAGS
9
+ CMAKE_C_FLAGS_DEBUG
10
+ CMAKE_C_FLAGS_RELEASE
11
+ )
12
+ foreach (CompilerFlag ${CompilerFlags} )
13
+ string (REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag} }" )
14
+ endforeach ()
15
+ endif ()
16
+
3
17
include_directories (
4
18
${LIBIPC_PROJECT_DIR} /3rdparty )
5
19
Original file line number Diff line number Diff line change @@ -2,6 +2,20 @@ project(ipc)
2
2
3
3
option (LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF )
4
4
5
+ if (MSVC AND USE_STATIC_CRT )
6
+ set (CompilerFlags
7
+ CMAKE_CXX_FLAGS
8
+ CMAKE_CXX_FLAGS_DEBUG
9
+ CMAKE_CXX_FLAGS_RELEASE
10
+ CMAKE_C_FLAGS
11
+ CMAKE_C_FLAGS_DEBUG
12
+ CMAKE_C_FLAGS_RELEASE
13
+ )
14
+ foreach (CompilerFlag ${CompilerFlags} )
15
+ string (REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag} }" )
16
+ endforeach ()
17
+ endif ()
18
+
5
19
if (UNIX )
6
20
file (GLOB SRC_FILES ${LIBIPC_PROJECT_DIR} /src/libipc/platform/*_linux.cpp )
7
21
else ()
Original file line number Diff line number Diff line change 1
1
project (test -ipc )
2
2
3
+ if (MSVC AND USE_STATIC_CRT )
4
+ set (CompilerFlags
5
+ CMAKE_CXX_FLAGS
6
+ CMAKE_CXX_FLAGS_DEBUG
7
+ CMAKE_CXX_FLAGS_RELEASE
8
+ CMAKE_C_FLAGS
9
+ CMAKE_C_FLAGS_DEBUG
10
+ CMAKE_C_FLAGS_RELEASE
11
+ )
12
+ foreach (CompilerFlag ${CompilerFlags} )
13
+ string (REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag} }" )
14
+ endforeach ()
15
+ endif ()
16
+
3
17
if (NOT MSVC )
4
18
add_compile_options (
5
19
-Wno-attributes
You can’t perform that action at this time.
0 commit comments