Skip to content

Commit

Permalink
#1602: CMake: set warning flags first
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Nov 18, 2021
1 parent 9cff903 commit 582ed9b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmake-modules/SetCXXCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ if (vt_ubsan_enabled)
endif()

message(DEBUG "Target ${vt_target} compile options: ${TARGET_CXX_FLAGS}")
target_compile_options(${vt_target} PUBLIC ${TARGET_CXX_FLAGS})
target_compile_options(${vt_target} PUBLIC ${TARGET_CXX_FLAGS}) # PRIVATE?

endmacro()
2 changes: 1 addition & 1 deletion cmake/turn_on_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include(CheckCXXCompilerFlag)
function(enable_cxx_compiler_flag_if_supported flag)
check_cxx_compiler_flag("${flag}" flag_supported)
if(flag_supported)
target_compile_options(${vt_target} PUBLIC ${flag})
target_compile_options(${vt_target} PUBLIC ${flag}) # PRIVATE?
endif()
unset(flag_supported CACHE)
endfunction()
Expand Down
2 changes: 2 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ macro(add_example example_name)
set_target_properties(${example_name} PROPERTIES UNITY_BUILD ON)
endif()

# compiler flags / warnings

link_target_with_vt(
TARGET ${example_name}
DEFAULT_LINK_SET
Expand Down
6 changes: 3 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ target_compile_features(
cxx_alias_templates
)

include(SetCXXCompilerFlags)
set_darma_compiler_flags(${VIRTUAL_TRANSPORT_LIBRARY})

include(turn_on_warnings)
turn_on_warnings(${VIRTUAL_TRANSPORT_LIBRARY})

include(SetCXXCompilerFlags)
set_darma_compiler_flags(${VIRTUAL_TRANSPORT_LIBRARY})

if (vt_gold_linker_enabled)
if (UNIX AND NOT APPLE)
execute_process(
Expand Down

0 comments on commit 582ed9b

Please sign in to comment.