mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-06 16:56:45 +08:00
Add USE_STATIC_CRT option to support static CRT(/MT).
This commit is contained in:
parent
faa2f10e3a
commit
43179d6ea0
14
3rdparty/gtest/CMakeLists.txt
vendored
14
3rdparty/gtest/CMakeLists.txt
vendored
@ -26,6 +26,20 @@ option(
|
|||||||
"Build gtest with internal symbols hidden in shared libraries."
|
"Build gtest with internal symbols hidden in shared libraries."
|
||||||
OFF)
|
OFF)
|
||||||
|
|
||||||
|
if (MSVC AND USE_STATIC_CRT)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
|
# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
|
||||||
include(cmake/hermetic_build.cmake OPTIONAL)
|
include(cmake/hermetic_build.cmake OPTIONAL)
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ project(cpp-ipc)
|
|||||||
|
|
||||||
option(LIBIPC_BUILD_TESTS "Build all of libipc's own tests." OFF)
|
option(LIBIPC_BUILD_TESTS "Build all of libipc's own tests." OFF)
|
||||||
option(LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF)
|
option(LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF)
|
||||||
|
option(USE_STATIC_CRT "Set to ON to build with static CRT on Windows (/MT)." OFF)
|
||||||
|
|
||||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
@ -13,8 +14,13 @@ endif()
|
|||||||
|
|
||||||
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
|
||||||
|
|
||||||
set(LIBIPC_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
set(LIBIPC_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
||||||
|
# Unicode Support
|
||||||
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if (LIBIPC_BUILD_TESTS)
|
if (LIBIPC_BUILD_TESTS)
|
||||||
|
|||||||
@ -1,5 +1,19 @@
|
|||||||
project(chat)
|
project(chat)
|
||||||
|
|
||||||
|
if (MSVC AND USE_STATIC_CRT)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB SRC_FILES ./*.cpp)
|
file(GLOB SRC_FILES ./*.cpp)
|
||||||
file(GLOB HEAD_FILES ./*.h)
|
file(GLOB HEAD_FILES ./*.h)
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,19 @@
|
|||||||
project(msg_que)
|
project(msg_que)
|
||||||
|
|
||||||
|
if (MSVC AND USE_STATIC_CRT)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${LIBIPC_PROJECT_DIR}/3rdparty)
|
${LIBIPC_PROJECT_DIR}/3rdparty)
|
||||||
|
|
||||||
|
|||||||
@ -2,6 +2,20 @@ project(ipc)
|
|||||||
|
|
||||||
option(LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
option(LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
|
||||||
|
|
||||||
|
if (MSVC AND USE_STATIC_CRT)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
file(GLOB SRC_FILES ${LIBIPC_PROJECT_DIR}/src/libipc/platform/*_linux.cpp)
|
file(GLOB SRC_FILES ${LIBIPC_PROJECT_DIR}/src/libipc/platform/*_linux.cpp)
|
||||||
else()
|
else()
|
||||||
|
|||||||
@ -1,5 +1,19 @@
|
|||||||
project(test-ipc)
|
project(test-ipc)
|
||||||
|
|
||||||
|
if (MSVC AND USE_STATIC_CRT)
|
||||||
|
set(CompilerFlags
|
||||||
|
CMAKE_CXX_FLAGS
|
||||||
|
CMAKE_CXX_FLAGS_DEBUG
|
||||||
|
CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_C_FLAGS
|
||||||
|
CMAKE_C_FLAGS_DEBUG
|
||||||
|
CMAKE_C_FLAGS_RELEASE
|
||||||
|
)
|
||||||
|
foreach(CompilerFlag ${CompilerFlags})
|
||||||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wno-attributes
|
-Wno-attributes
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user