From c4553654c9b6a31a87997e4045733ab8b6527213 Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Mon, 27 Jan 2025 23:48:56 +0100 Subject: [PATCH 1/2] Add helper function that allows removal of a compile option from targets Signed-off-by: Kai-Uwe Hermann --- everest-cmake-config.cmake | 1 + helpers.cmake | 46 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 helpers.cmake diff --git a/everest-cmake-config.cmake b/everest-cmake-config.cmake index fe49646..47ff81b 100644 --- a/everest-cmake-config.cmake +++ b/everest-cmake-config.cmake @@ -22,6 +22,7 @@ if (everest_cmake_FOUND) endif() include("${CMAKE_CURRENT_LIST_DIR}/edm.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/helpers.cmake") include("${CMAKE_CURRENT_LIST_DIR}/python-package-helpers.cmake") include("${CMAKE_CURRENT_LIST_DIR}/python-virtualenv.cmake") diff --git a/helpers.cmake b/helpers.cmake new file mode 100644 index 0000000..1290e97 --- /dev/null +++ b/helpers.cmake @@ -0,0 +1,46 @@ +function(ev_remove_target_compile_option) + set(one_value_args + PREFIX # removes all compile options with this prefix + EXACT # removes an option only if it matches exactly + ) + + set(multi_value_args + TARGETS + ) + + cmake_parse_arguments( + "args" + "" + "${one_value_args}" + "${multi_value_args}" + ${ARGN} + ) + + foreach(target ${args_TARGETS}) + set(COMPILE_OPTIONS_TO_REMOVE "") + get_target_property(TARGET_COMPILE_OPTIONS "${target}" COMPILE_OPTIONS) + # find applicable compile options for this target + foreach(compile_option ${TARGET_COMPILE_OPTIONS}) + # collect compile options with a certain prefix + if(NOT "${args_PREFIX}" STREQUAL "") + string(FIND "${compile_option}" "${args_PREFIX}" POSITION) + if("${POSITION}" EQUAL "0") + list(APPEND COMPILE_OPTIONS_TO_REMOVE "${compile_option}") + endif() + endif() + # collect compile options with an exact match + if(NOT "${args_EXACT}" STREQUAL "") + if("${args_EXACT}" STREQUAL "${compile_option}") + message(STATUS "FOUND IT! ${compile_option} equals ${args_EXACT}") + list(APPEND COMPILE_OPTIONS_TO_REMOVE "${compile_option}") + endif() + endif() + endforeach() + + # remove the collected compile options from the target + foreach(compile_option ${COMPILE_OPTIONS_TO_REMOVE}) + list(REMOVE_ITEM TARGET_COMPILE_OPTIONS "${compile_option}") + endforeach() + set_target_properties("${target}" PROPERTIES COMPILE_OPTIONS "${TARGET_COMPILE_OPTIONS}") + endforeach() +endfunction() From e4695a456fac44a065012b4d1ef1d94e13c64aff Mon Sep 17 00:00:00 2001 From: Kai-Uwe Hermann Date: Mon, 27 Jan 2025 23:51:44 +0100 Subject: [PATCH 2/2] Bump version to 0.6.0 Signed-off-by: Kai-Uwe Hermann --- everest-cmake-config-version.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/everest-cmake-config-version.cmake b/everest-cmake-config-version.cmake index 25c790e..403ca67 100644 --- a/everest-cmake-config-version.cmake +++ b/everest-cmake-config-version.cmake @@ -1,9 +1,9 @@ -set(PACKAGE_VERSION 0.5.1) +set(PACKAGE_VERSION 0.6.0) if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) set(PACKAGE_VERSION_EXACT TRUE) elseif (PACKAGE_FIND_VERSION_MAJOR STREQUAL "0") - if (PACKAGE_FIND_VERSION_MINOR GREATER "5") + if (PACKAGE_FIND_VERSION_MINOR GREATER "6") set(PACKAGE_VERSION_UNSUITABLE TRUE) else () set(PACKAGE_VERSION_COMPATIBLE TRUE)