From 4cfe81804b577f03a829ba153f051af05145f4d2 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Fri, 13 Sep 2024 15:11:05 -0700 Subject: [PATCH 01/10] Silence warnings associated with the deprecated stdext::checked_array_iterator on MSVC --- cmake/OpenSimMacros.cmake | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cmake/OpenSimMacros.cmake b/cmake/OpenSimMacros.cmake index f24eacd046..e1b9e537e9 100644 --- a/cmake/OpenSimMacros.cmake +++ b/cmake/OpenSimMacros.cmake @@ -221,10 +221,9 @@ function(OpenSimAddLibrary) # This target links to the libraries provided as arguments to this func. target_link_libraries(${OSIMADDLIB_LIBRARY_NAME} ${OSIMADDLIB_LINKLIBS}) - target_compile_options(${OSIMADDLIB_LIBRARY_NAME} PUBLIC - # disable warning 4996 on Windows: `spdlog` transitively - # uses a deprecated `stdext::checked_array_iterator` - $<$:/wd4996> + target_compile_definitions(${OSIMADDLIB_LIBRARY_NAME} PUBLIC + # `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` + $<$:_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING> ) # This is for exporting classes on Windows. From 486d9f293005633968e38223abd221d2f6e92cda Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Fri, 13 Sep 2024 16:12:15 -0700 Subject: [PATCH 02/10] Add back target_compile_options for ignoring /wd4996 --- cmake/OpenSimMacros.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/OpenSimMacros.cmake b/cmake/OpenSimMacros.cmake index e1b9e537e9..9a3566c955 100644 --- a/cmake/OpenSimMacros.cmake +++ b/cmake/OpenSimMacros.cmake @@ -221,6 +221,12 @@ function(OpenSimAddLibrary) # This target links to the libraries provided as arguments to this func. target_link_libraries(${OSIMADDLIB_LIBRARY_NAME} ${OSIMADDLIB_LINKLIBS}) + target_compile_options(${OSIMADDLIB_LIBRARY_NAME} PUBLIC + # disable warning 4996 on Windows: `spdlog` transitively + # uses a deprecated `stdext::checked_array_iterator` + $<$:/wd4996> + ) + target_compile_definitions(${OSIMADDLIB_LIBRARY_NAME} PUBLIC # `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` $<$:_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING> From efbcf9fd33b8ebc711f796844304bcdf3af2eaf3 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 10:53:38 -0700 Subject: [PATCH 03/10] Forward silence flag to CMAKE_CXX_FLAGS for spdlog --- dependencies/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 7ecea1ffa0..526f2c6b86 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -201,7 +201,8 @@ AddDependency(NAME spdlog CMAKE_ARGS -DSPDLOG_BUILD_BENCH:BOOL=OFF -DSPDLOG_BUILD_TESTS:BOOL=OFF -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON) + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON, + -DCMAKE_CXX_FLAGS:STRING="/D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") AddDependency(NAME catch2 DEFAULT ON From 0734caa5c02d0a65c15fbe4044fd80a84a16f1c8 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 11:06:43 -0700 Subject: [PATCH 04/10] Only pass D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING for MSVC --- dependencies/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 526f2c6b86..a2f5e0ae82 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -193,6 +193,10 @@ AddDependency(NAME docopt GIT_URL https://github.com/docopt/docopt.cpp.git GIT_TAG 3dd23e3280f213bacefdf5fcb04857bf52e90917) +set(SPDLOG_CXX_FLAGS "") +if(MSVC) + set(SPDLOG_CXX_FLAGS "/D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") +endif() AddDependency(NAME spdlog DEFAULT ON @@ -202,7 +206,7 @@ AddDependency(NAME spdlog -DSPDLOG_BUILD_TESTS:BOOL=OFF -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON, - -DCMAKE_CXX_FLAGS:STRING="/D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") + -DCMAKE_CXX_FLAGS:STRING=${SPDLOG_CXX_FLAGS}) AddDependency(NAME catch2 DEFAULT ON From 992cebe9316f64da77583788d71f7b02e77f0f72 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 11:51:10 -0700 Subject: [PATCH 05/10] Remove comma --- dependencies/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index a2f5e0ae82..5c25e30262 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -205,7 +205,7 @@ AddDependency(NAME spdlog CMAKE_ARGS -DSPDLOG_BUILD_BENCH:BOOL=OFF -DSPDLOG_BUILD_TESTS:BOOL=OFF -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON, + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON -DCMAKE_CXX_FLAGS:STRING=${SPDLOG_CXX_FLAGS}) AddDependency(NAME catch2 From df12a4f7a9adba6591f9346c13b1f906ae146be9 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 12:28:07 -0700 Subject: [PATCH 06/10] Prepend OpenSim project CMAKE_CXX_FLAGS --- dependencies/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 5c25e30262..61e00fdf1b 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -195,7 +195,7 @@ AddDependency(NAME docopt set(SPDLOG_CXX_FLAGS "") if(MSVC) - set(SPDLOG_CXX_FLAGS "/D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") + set(SPDLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") endif() AddDependency(NAME spdlog From a0f120763b82106d540a1a5651c6ab1bde2722e3 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 12:32:30 -0700 Subject: [PATCH 07/10] Always pass CMAKE_CXX_FLAGS --- dependencies/CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 61e00fdf1b..c0260cda0f 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -192,10 +192,11 @@ AddDependency(NAME docopt DEFAULT ON GIT_URL https://github.com/docopt/docopt.cpp.git GIT_TAG 3dd23e3280f213bacefdf5fcb04857bf52e90917) - -set(SPDLOG_CXX_FLAGS "") + +# `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` +set(SPDLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS}") if(MSVC) - set(SPDLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") + set(SPDLOG_CXX_FLAGS "${SPDLOG_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") endif() AddDependency(NAME spdlog From 14d9efd394feec9d5e6e7b47ce14c2d29e6147be Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 13:03:25 -0700 Subject: [PATCH 08/10] Try appending to CMAKE_CXX_FLAGS directly --- dependencies/CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index c0260cda0f..2054a330df 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -194,9 +194,8 @@ AddDependency(NAME docopt GIT_TAG 3dd23e3280f213bacefdf5fcb04857bf52e90917) # `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` -set(SPDLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS}") if(MSVC) - set(SPDLOG_CXX_FLAGS "${SPDLOG_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") endif() AddDependency(NAME spdlog @@ -206,8 +205,7 @@ AddDependency(NAME spdlog CMAKE_ARGS -DSPDLOG_BUILD_BENCH:BOOL=OFF -DSPDLOG_BUILD_TESTS:BOOL=OFF -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON - -DCMAKE_CXX_FLAGS:STRING=${SPDLOG_CXX_FLAGS}) + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON) AddDependency(NAME catch2 DEFAULT ON From 94d7a4d859f521e1254993ac6507d3d86be29d66 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 13:52:16 -0700 Subject: [PATCH 09/10] Only pass stdext::checked_array_iterator deprecation flag to spdlog build --- dependencies/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 2054a330df..0b68f0bff7 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -105,7 +105,6 @@ function(AddDependency) list(APPEND CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}) endif() - list(APPEND CMAKE_ARGS ${DEP_CMAKE_ARGS}) # Forward cmake arguments to dependencies. list(APPEND CMAKE_ARGS @@ -140,6 +139,9 @@ function(AddDependency) list(APPEND CMAKE_ARGS -DSWIG_EXECUTABLE:FILEPATH=${SWIG_EXECUTABLE}) endif() + # Append the dependency-specific CMake arguments. + list(APPEND CMAKE_ARGS ${DEP_CMAKE_ARGS}) + if(DEP_GIT_URL) ExternalProject_Add(${DEP_NAME} DEPENDS ${DEP_DEPENDS} @@ -192,10 +194,11 @@ AddDependency(NAME docopt DEFAULT ON GIT_URL https://github.com/docopt/docopt.cpp.git GIT_TAG 3dd23e3280f213bacefdf5fcb04857bf52e90917) - -# `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` + +set(SPDLOG_CXX_FLAGS "${CMAKE_CXX_FLAGS}") if(MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") + # `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` + set(SPDLOG_CXX_FLAGS "${SPDLOG_CXX_FLAGS} /D_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING") endif() AddDependency(NAME spdlog @@ -205,7 +208,8 @@ AddDependency(NAME spdlog CMAKE_ARGS -DSPDLOG_BUILD_BENCH:BOOL=OFF -DSPDLOG_BUILD_TESTS:BOOL=OFF -DSPDLOG_BUILD_EXAMPLE:BOOL=OFF - -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON) + -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON + -DCMAKE_CXX_FLAGS:STRING=${SPDLOG_CXX_FLAGS}) AddDependency(NAME catch2 DEFAULT ON From 597b30e99c46636d0294fe97b4977d5e25ddcf18 Mon Sep 17 00:00:00 2001 From: Nicholas Bianco Date: Mon, 16 Sep 2024 15:21:33 -0700 Subject: [PATCH 10/10] Remove /wd4996 compiler option --- cmake/OpenSimMacros.cmake | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cmake/OpenSimMacros.cmake b/cmake/OpenSimMacros.cmake index 9a3566c955..e1b9e537e9 100644 --- a/cmake/OpenSimMacros.cmake +++ b/cmake/OpenSimMacros.cmake @@ -221,12 +221,6 @@ function(OpenSimAddLibrary) # This target links to the libraries provided as arguments to this func. target_link_libraries(${OSIMADDLIB_LIBRARY_NAME} ${OSIMADDLIB_LINKLIBS}) - target_compile_options(${OSIMADDLIB_LIBRARY_NAME} PUBLIC - # disable warning 4996 on Windows: `spdlog` transitively - # uses a deprecated `stdext::checked_array_iterator` - $<$:/wd4996> - ) - target_compile_definitions(${OSIMADDLIB_LIBRARY_NAME} PUBLIC # `spdlog` transitively uses a deprecated `stdext::checked_array_iterator` $<$:_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING>