suppress warnings only for 3rd party code for Release builds

release/4.3a0
Varun Agrawal 2020-07-10 21:43:30 -04:00
parent 10a131fc36
commit 1fadf1e7ef
1 changed files with 9 additions and 8 deletions

View File

@ -15,7 +15,7 @@ set (gtsam_subdirs
sfm sfm
slam slam
smart smart
navigation navigation
) )
set(gtsam_srcs) 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_BOOST_LIBRARIES})
target_link_libraries(gtsam PUBLIC ${GTSAM_ADDITIONAL_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: # Apply build flags:
gtsam_apply_build_flags(gtsam) gtsam_apply_build_flags(gtsam)
@ -191,11 +186,17 @@ install(
list(APPEND GTSAM_EXPORTED_TARGETS gtsam) list(APPEND GTSAM_EXPORTED_TARGETS gtsam)
set(GTSAM_EXPORTED_TARGETS "${GTSAM_EXPORTED_TARGETS}" PARENT_SCOPE) 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) if(WIN32)
set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w") set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-w")
else() 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") set_source_files_properties(${3rdparty_srcs} PROPERTIES COMPILE_FLAGS "-Wno-error")
endif()
endif() endif()
# Create the matlab toolbox for the gtsam library # Create the matlab toolbox for the gtsam library