File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ include (FetchContent)
2+
3+ # GoogleTest
4+ # For Windows: prevent overriding the parent project's compiler/linker settings
5+ set (gtest_force_shared_crt ON CACHE BOOL "" FORCE)
6+
7+ FetchContent_Declare(
8+ googletest
9+ GIT_REPOSITORY https://github.com/google/googletest.git
10+ GIT_TAG v1.14.0
11+ )
12+
13+ FetchContent_MakeAvailable(googletest)
Original file line number Diff line number Diff line change 1+ set (CMAKE_CXX_STANDARD 20)
2+ set (CMAKE_CXX_STANDARD_REQUIRED ON )
3+ set (CMAKE_CXX_EXTENSIONS OFF )
4+
5+ if (NOT CMAKE_BUILD_TYPE )
6+ set (CMAKE_BUILD_TYPE Release)
7+ endif ()
8+
9+
10+ if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
11+ set (CMAKE_CXX_FLAGS_DEBUG "/MDd" )
12+ set (CMAKE_CXX_FLAGS_RELEASE "/O2" )
13+ else ()
14+ set (CMAKE_CXX_FLAGS_DEBUG "-g -O0" )
15+ set (CMAKE_CXX_FLAGS_RELEASE "-O3" )
16+ endif ()
17+
18+ message (STATUS "Build type: ${CMAKE_BUILD_TYPE} " )
19+ message (STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID} " )
20+ message (STATUS "Compiler version: ${CMAKE_CXX_COMPILER_VERSION} " )
21+ message (STATUS "Compiler flags: ${CMAKE_CXX_FLAGS} " )
22+ message (STATUS "Compiler flags debug: ${CMAKE_CXX_FLAGS_DEBUG} " )
23+ message (STATUS "Compiler flags release: ${CMAKE_CXX_FLAGS_RELEASE} " )
24+
25+ # Windows: place runtime artifacts next to the executable
26+ if (WIN32 )
27+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
28+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
29+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR} )
30+ set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
31+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
32+ set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR} )
33+ endif ()
You can’t perform that action at this time.
0 commit comments