diff --git a/CMakeLists.txt b/CMakeLists.txt index 04795a372..4ae8d9627 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,6 +76,8 @@ target_compile_options( $<$:/WX> # all warnings as errors $<$:/EHsc> # exceptions $<$:/wd4068> # pragma + $<$:/D_USE_MATH_DEFINES> + $<$>,$>:-D_USE_MATH_DEFINES> $<$:/D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS> $<$:/D_CRT_SECURE_NO_WARNINGS> ) diff --git a/expression-test/CMakeLists.txt b/expression-test/CMakeLists.txt index f9120ac7c..195975205 100644 --- a/expression-test/CMakeLists.txt +++ b/expression-test/CMakeLists.txt @@ -29,6 +29,7 @@ target_link_libraries( Mapbox::Base::Extras::args Mapbox::Base::Extras::filesystem mbgl-core + mbgl-compiler-options ) set_property(TARGET mbgl-expression-test PROPERTY FOLDER Executables) diff --git a/platform/glfw/CMakeLists.txt b/platform/glfw/CMakeLists.txt index 1b4d8a8e2..721c727cf 100644 --- a/platform/glfw/CMakeLists.txt +++ b/platform/glfw/CMakeLists.txt @@ -65,7 +65,6 @@ if(WIN32) target_compile_definitions( mbgl-glfw PRIVATE - _USE_MATH_DEFINES NOMINMAX CURL_STATICLIB ) diff --git a/platform/node/cmake/module.cmake b/platform/node/cmake/module.cmake index ae43821c0..2dca7d294 100644 --- a/platform/node/cmake/module.cmake +++ b/platform/node/cmake/module.cmake @@ -178,7 +178,7 @@ function(add_node_module NAME) if(WIN32) target_include_directories(${_TARGET} SYSTEM PRIVATE "${PROJECT_SOURCE_DIR}/platform/windows/include") - target_compile_definitions(${_TARGET} PRIVATE _USE_MATH_DEFINES NOMINMAX) + target_compile_definitions(${_TARGET} PRIVATE NOMINMAX) target_link_libraries(${_TARGET} PRIVATE "${_CACHE_DIR}/lib/node/${_NODE_VERSION}/win-${_ARCH}/node.lib") endif() diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake index 9cd46f19f..35c6395e0 100644 --- a/platform/qt/qt.cmake +++ b/platform/qt/qt.cmake @@ -42,14 +42,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux") endif() endif() -if(MSVC) - add_definitions("/DQT_COMPILING_QIMAGE_COMPAT_CPP") - add_definitions("/D_USE_MATH_DEFINES") -elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_definitions("-DQT_COMPILING_QIMAGE_COMPAT_CPP") - add_definitions("-D_USE_MATH_DEFINES") -endif() - +# Debugging & ccache on Windows if (MSVC) foreach(config DEBUG RELWITHDEBINFO) foreach(lang C CXX) diff --git a/platform/windows/windows.cmake b/platform/windows/windows.cmake index 1e006f70b..85e73ffa2 100644 --- a/platform/windows/windows.cmake +++ b/platform/windows/windows.cmake @@ -9,7 +9,7 @@ endif() execute_process(COMMAND powershell -ExecutionPolicy Bypass -File ${CMAKE_CURRENT_LIST_DIR}/Get-VendorPackages.ps1 -Triplet ${VCPKG_TARGET_TRIPLET} -Renderer ${_RENDERER}) unset(_RENDERER) -add_compile_definitions(NOMINMAX _USE_MATH_DEFINES GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) +add_compile_definitions(NOMINMAX GHC_WIN_DISABLE_WSTRING_STORAGE_TYPE) target_compile_options( mbgl-compiler-options