소스 검색

Clean up configuration related to Windows CRT

Lucien Greathouse 1 년 전
부모
커밋
725adf3114
1개의 변경된 파일17개의 추가작업 그리고 8개의 파일을 삭제
  1. 17 8
      CMakeLists.txt

+ 17 - 8
CMakeLists.txt

@@ -1,22 +1,30 @@
 cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
 
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-
-project(JoltC VERSION 0.1
-    DESCRIPTION "C Wrapper for Jolt Physics"
-    LANGUAGES C CXX)
-
 # When turning this option on, the library will be compiled using doubles for positions. This allows for much bigger worlds.
 option(DOUBLE_PRECISION "Use double precision math" OFF)
 
 # Number of bits to use in ObjectLayer. Can be 16 or 32.
 option(OBJECT_LAYER_BITS "Number of bits in ObjectLayer" 16)
 
+include(CMakeDependentOption)
+
+# Ability to toggle between the static and DLL versions of the MSVC runtime library
+# Windows Store only supports the DLL version
+cmake_dependent_option(USE_STATIC_MSVC_RUNTIME_LIBRARY "Use the static MSVC runtime library" ON "MSVC;NOT WINDOWS_STORE" OFF)
+
+if (USE_STATIC_MSVC_RUNTIME_LIBRARY)
+  set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+endif()
+
 # Only do this when we're at the top level, see: https://gitlab.kitware.com/cmake/cmake/-/issues/24181
 if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
     set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
 endif()
 
+project(JoltC VERSION 0.1
+    DESCRIPTION "C Wrapper for Jolt Physics"
+    LANGUAGES C CXX)
+
 add_library(joltc STATIC
     JoltC/JoltC.h
     JoltC/JoltC.cpp
@@ -29,6 +37,8 @@ target_compile_features(joltc PUBLIC cxx_std_17)
 target_include_directories(joltc PUBLIC . JoltPhysics)
 target_link_libraries(joltc PUBLIC Jolt)
 
+install(TARGETS joltc DESTINATION lib)
+
 if(MSVC)
   target_compile_options(joltc PRIVATE /W4)
 
@@ -61,5 +71,4 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
     target_link_libraries(HelloWorld PUBLIC joltc)
 endif()
 
-
-add_subdirectory(JoltPhysics/Build)
+add_subdirectory(JoltPhysics/Build)