Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Sofa/framework/Config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ target_link_options(${PROJECT_NAME} PUBLIC "$<${is_c_cxx_release}:${SOFACONFIG_L
target_link_options(${PROJECT_NAME} PUBLIC "$<${is_c_cxx_debug}:${SOFACONFIG_LINK_OPTIONS_DEBUG}>")
target_link_options(${PROJECT_NAME} PUBLIC "$<${is_c_cxx}:${SOFACONFIG_LINK_OPTIONS}>")

sofa_treat_warnings_as_errors(${PROJECT_NAME})

set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder

# Attach Sofa Version into properties
Expand Down
10 changes: 10 additions & 0 deletions Sofa/framework/Config/cmake/SofaMacrosConfigure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,13 @@ macro(sofa_set_targets_release_only)
endmacro()


function(sofa_treat_warnings_as_errors TARGET)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
set_property(TARGET ${TARGET} PROPERTY COMPILE_WARNING_AS_ERROR ON)
else()
target_compile_options(${TARGET} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/WX>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Werror>
)
endif()
endfunction()
1 change: 1 addition & 0 deletions Sofa/framework/Type/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ if(mimalloc_FOUND)
endif()

set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Sofa.Framework) # IDE folder
sofa_treat_warnings_as_errors(${PROJECT_NAME})

sofa_create_package_with_targets(
PACKAGE_NAME ${PROJECT_NAME}
Expand Down
Loading