Skip to content

Commit 2c2b65b

Browse files
committed
1.[UPDATE]:update cmake file struct
1 parent 5a2847f commit 2c2b65b

1 file changed

Lines changed: 14 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ if("${CMAKE_BUILD_TYPE}" MATCHES "[Rr]elease")
1616
set(DIMS_BUILD_TESTING
1717
OFF
1818
CACHE BOOL "Disable tests generation" FORCE)
19-
endif()
20-
21-
if("${CMAKE_BUILD_TYPE}" MATCHES "[Dd]ebug")
19+
else()
2220
message(STATUS "This is a Debug build.")
23-
# add_subdirectory(external/backward-cpp)
21+
set(DIMS_BUILD_TESTING
22+
ON
23+
CACHE BOOL "Disable tests generation" FORCE)
24+
enable_testing()
25+
add_subdirectory(tests)
26+
2427
endif()
2528

2629
if(NOT MSVC)
@@ -30,6 +33,13 @@ if(NOT MSVC)
3033
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_PROGRAM})
3134
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_PROGRAM})
3235
endif()
36+
else()
37+
# Enable MSVC exceptions (as above)
38+
message(STATUS "MSVC detected, enabling /EHsc")
39+
set(CMAKE_CXX_FLAGS
40+
"${CMAKE_CXX_FLAGS} /EHsc"
41+
CACHE STRING "MSVC exception flag" FORCE)
42+
add_compile_options(/EHsc)
3343
endif()
3444

3545
set(CMAKE_CXX_STANDARD 17)
@@ -73,15 +83,6 @@ set(BOOST_INCLUDE_LIBRARIES
7383
url
7484
json)
7585

76-
# Enable MSVC exceptions (as above)
77-
if(MSVC)
78-
message(STATUS "MSVC detected, enabling /EHsc")
79-
set(CMAKE_CXX_FLAGS
80-
"${CMAKE_CXX_FLAGS} /EHsc"
81-
CACHE STRING "MSVC exception flag" FORCE)
82-
add_compile_options(/EHsc)
83-
endif()
84-
8586
# -----------------------------
8687
# External Dependencies (FetchContent)
8788
# -----------------------------
@@ -102,11 +103,6 @@ FetchContent_MakeAvailable(boost gRPC)
102103
set(PROTOBUF_PROTOC_EXECUTABLE $<TARGET_FILE:protoc>)
103104
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:grpc_cpp_plugin>)
104105

105-
if(DIMS_BUILD_TESTING)
106-
enable_testing()
107-
add_subdirectory(tests)
108-
endif()
109-
110106
add_library(boost_common INTERFACE)
111107
target_link_libraries(boost_common INTERFACE Boost::asio Boost::system
112108
Boost::filesystem Boost::uuid)

0 commit comments

Comments
 (0)