- Fixes #1229 by defaulting to static MSVC runtime on Windows. - CMake will now fail if LIBIGL_WITH_CGAL is ON but CGAL is not found (e.g. missing Boost or gmp/mpfr). - Removed some duplicated template instantiations on Windows. - Added IGL_DEBUG_OFF to disable slow unit test in Debug configuration by default. - Do not FORCE options given to third-party libraries.
27 lines
1.2 KiB
CMake
27 lines
1.2 KiB
CMake
if(MSVC)
|
|
option(IGL_STATIC_RUNTIME "Use libigl with the static MSVC runtime." OFF)
|
|
if(IGL_STATIC_RUNTIME)
|
|
message(STATUS "MSVC -> forcing use of statically-linked runtime.")
|
|
foreach(config ${CMAKE_CONFIGURATION_TYPES})
|
|
string(TOUPPER ${config} config)
|
|
string(REPLACE /MD /MT CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
|
|
string(REPLACE /MD /MT CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
|
|
endforeach()
|
|
string(REPLACE "/MDd" "/MTd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
else()
|
|
message(STATUS "MSVC -> forcing use of dynamically-linked runtime.")
|
|
foreach(config ${CMAKE_CONFIGURATION_TYPES})
|
|
string(TOUPPER ${config} config)
|
|
string(REPLACE /MT /MD CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
|
|
string(REPLACE /MT /MD CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
|
|
endforeach()
|
|
string(REPLACE "/MTd" "/MDd" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
endif()
|
|
|
|
# https://github.com/mozilla/sccache/issues/242
|
|
if(CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "sccache")
|
|
string(REGEX REPLACE "/Z[iI7]" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Z7")
|
|
endif()
|
|
endif()
|