Skip to content

Commit

Permalink
Add SetDefaultProfile.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Sep 30, 2024
1 parent 297684f commit 61a3bfe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@ option(CMAKE_POSITION_INDEPENDENT_CODE "Set -fPIC" ON)
option(WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
option(COVERAGE "Coverage" OFF)

if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

Expand Down
10 changes: 2 additions & 8 deletions cmake/CompilerOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
include("${CMAKE_CURRENT_LIST_DIR}/SetDefaultProfile.cmake")

if(MSVC)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
if(BUILD_SHARED_LIBS)
# shared spdlog requires MultiThreadedDLL
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
add_definitions(-DWIN32 -D_WINDOWS)
add_compile_options(/W4 /GR /EHsc /utf-8 /wd4244 /wd4996)
add_compile_options("$<$<CONFIG:Release>:/Ox;/Ob2>")
Expand Down
18 changes: 18 additions & 0 deletions cmake/SetDefaultProfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if(MSVC AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
if(BUILD_SHARED_LIBS)
# shared spdlog requires MultiThreadedDLL
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
else()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
7 changes: 1 addition & 6 deletions cmake/ThirdParty.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@ if(USE_CONAN)
if(CMAKE_VERSION VERSION_LESS 3.24)
message(FATAL_ERROR "Automatic Conan integration requires CMake 3.24 or later.")
endif()
if(NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()
include("${CMAKE_CURRENT_LIST_DIR}/SetDefaultProfile.cmake")
list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/conan_provider.cmake)
endif()

Expand Down

0 comments on commit 61a3bfe

Please sign in to comment.