diff --git a/cmake/utils.cmake b/cmake/utils.cmake index ee8c8987..4c9dc09b 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -109,12 +109,16 @@ macro(momo_target_remove_compile_option target option) get_target_property(target_flags ${target} COMPILE_OPTIONS) if(target_flags) list(REMOVE_ITEM target_flags ${option}) + list(REMOVE_ITEM target_flags "$<$:${option}>") + list(REMOVE_ITEM target_flags "$<$:${option}>") set_target_properties(${target} PROPERTIES COMPILE_OPTIONS "${target_flags}") endif() get_target_property(target_interface_flags ${target} INTERFACE_COMPILE_OPTIONS) if(target_interface_flags) list(REMOVE_ITEM target_interface_flags ${option}) + list(REMOVE_ITEM target_interface_flags "$<$:${option}>") + list(REMOVE_ITEM target_interface_flags "$<$:${option}>") set_target_properties(${target} PROPERTIES INTERFACE_COMPILE_OPTIONS "${target_interface_flags}") endif() endmacro() @@ -122,13 +126,21 @@ endmacro() ########################################## macro(momo_target_remove_compile_options target) - foreach(option ${ARGV}) + foreach(option ${ARGN}) momo_target_remove_compile_option(${target} ${option}) endforeach() endmacro() ########################################## +function(momo_targets_remove_compile_options targets) + foreach(target ${targets}) + momo_target_remove_compile_options(${target} ${ARGN}) + endforeach() +endfunction() + +########################################## + function(momo_add_compile_options language) foreach(option ${ARGN}) add_compile_options( diff --git a/src/samples/CMakeLists.txt b/src/samples/CMakeLists.txt index b9067a51..d4839797 100644 --- a/src/samples/CMakeLists.txt +++ b/src/samples/CMakeLists.txt @@ -1,2 +1,12 @@ +momo_get_all_targets(EXISTING_TARGETS) + +########################################## + add_subdirectory(bad-sample) add_subdirectory(test-sample) + +########################################## + +momo_get_all_targets(ALL_TARGETS) +momo_list_difference("${ALL_TARGETS}" "${EXISTING_TARGETS}" SAMPLE_TARGETS) +momo_targets_remove_compile_options("${SAMPLE_TARGETS}" /arch:AVX2 -mavx2) \ No newline at end of file