From b1dda699a336ff868d498401b138869bbf9441b8 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Thu, 9 Jul 2020 23:49:23 -0400 Subject: [PATCH 1/4] add compiler flags to suppress warnings if built in release mode --- gtsam/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 3d1bbd2a7..2ca83e093 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -106,6 +106,11 @@ add_library(gtsam ${gtsam_srcs}) target_link_libraries(gtsam PUBLIC ${GTSAM_BOOST_LIBRARIES}) target_link_libraries(gtsam PUBLIC ${GTSAM_ADDITIONAL_LIBRARIES}) +if(${CMAKE_BUILD_TYPE} STREQUAL "Release") + # Suppress warnings if Release build + target_compile_options(gtsam PRIVATE -w) +endif() + # Apply build flags: gtsam_apply_build_flags(gtsam) From 10a131fc365146f970e33dc0c3939dc9189385f3 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 10 Jul 2020 00:19:54 -0400 Subject: [PATCH 2/4] Quote variable so it works on Windows --- gtsam/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index 2ca83e093..c4ad0a755 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -106,7 +106,7 @@ add_library(gtsam ${gtsam_srcs}) target_link_libraries(gtsam PUBLIC ${GTSAM_BOOST_LIBRARIES}) target_link_libraries(gtsam PUBLIC ${GTSAM_ADDITIONAL_LIBRARIES}) -if(${CMAKE_BUILD_TYPE} STREQUAL "Release") +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") # Suppress warnings if Release build target_compile_options(gtsam PRIVATE -w) endif() From 1fadf1e7ef032e5e6a6d74e5a1a5e8cf7865ce3d Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Fri, 10 Jul 2020 21:43:30 -0400 Subject: [PATCH 3/4] suppress warnings only for 3rd party code for Release builds --- gtsam/CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index c4ad0a755..a927ca3a0 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -15,7 +15,7 @@ set (gtsam_subdirs sfm slam smart - navigation + navigation ) set(gtsam_srcs) @@ -106,11 +106,6 @@ add_library(gtsam ${gtsam_srcs}) target_link_libraries(gtsam PUBLIC ${GTSAM_BOOST_LIBRARIES}) target_link_libraries(gtsam PUBLIC ${GTSAM_ADDITIONAL_LIBRARIES}) -if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - # Suppress warnings if Release build - target_compile_options(gtsam PRIVATE -w) -endif() - # Apply build flags: gtsam_apply_build_flags(gtsam) @@ -191,11 +186,17 @@ install( list(APPEND GTSAM_EXPORTED_TARGETS gtsam) set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE) -# make sure that ccolamd compiles even in face of warnings +# Make sure that ccolamd compiles even in face of warnings +# and suppress all warnings from 3rd party code if Release build if(WIN32) - set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w") + set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w") else() + if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + # Suppress all warnings from 3rd party sources. + set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w") + else() set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-Wno-error") + endif() endif() # Create the matlab toolbox for the gtsam library From 7b23f570f9758d4bf407436d6c42c88d7f9d5ad7 Mon Sep 17 00:00:00 2001 From: Varun Agrawal Date: Sat, 11 Jul 2020 14:33:40 -0400 Subject: [PATCH 4/4] correct compiler flag for Windows --- gtsam/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtsam/CMakeLists.txt b/gtsam/CMakeLists.txt index a927ca3a0..16dca6736 100644 --- a/gtsam/CMakeLists.txt +++ b/gtsam/CMakeLists.txt @@ -189,7 +189,7 @@ set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE) # Make sure that ccolamd compiles even in face of warnings # and suppress all warnings from 3rd party code if Release build if(WIN32) - set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w") + set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "/w") else() if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") # Suppress all warnings from 3rd party sources.