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) 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()