Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a wrapper module for add_test #240

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.. cmake-module:: ../../src/DynamicProjectOptions.cmake
.. cmake-module:: ../../src/StaticAnalyzers.cmake
.. cmake-module:: ../../src/Sanitizers.cmake
.. cmake-module:: ../../src/Tests.cmake
.. cmake-module:: ../../src/Linker.cmake
.. cmake-module:: ../../src/CrossCompiler.cmake
.. cmake-module:: ../../src/Cuda.cmake
Expand Down
23 changes: 5 additions & 18 deletions src/PackageProject.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
include_guard()

include("${CMAKE_CURRENT_LIST_DIR}/Utilities.cmake")

# Uses ycm (permissive BSD-3-Clause license) and ForwardArguments (permissive MIT license)

function(get_property_of_targets)
Expand Down Expand Up @@ -319,19 +317,6 @@ function(package_project)
include("${_ycm_SOURCE_DIR}/modules/AddUninstallTarget.cmake")
endfunction()

function(set_or_append_target_property target property new_values)
get_target_property(_AllValues ${target} ${property})

if(NOT _AllValues) # If the property hasn't set
set(_AllValues "${new_values}")
else()
list(APPEND _AllValues ${new_values})
endif()
list(REMOVE_DUPLICATES _AllValues)

set_target_properties(${target} PROPERTIES ${property} "${_AllValues}")
endfunction()

#[[.rst:

``target_include_interface_directories``
Expand Down Expand Up @@ -378,7 +363,7 @@ function(target_include_interface_directories target)
endif()

# Append include_dir to target property PROJECT_OPTIONS_INTERFACE_DIRECTORIES
set_or_append_target_property(${target} "PROJECT_OPTIONS_INTERFACE_DIRECTORIES" ${include_dir})
set_property(TARGET ${target} APPEND PROPERTY PROJECT_OPTIONS_INTERFACE_DIRECTORIES ${include_dir})

# Include the interface directory
get_target_property(_HasSourceFiles ${target} SOURCES)
Expand Down Expand Up @@ -481,8 +466,10 @@ macro(target_find_dependencies target)
endforeach()

# Append to target property
set_or_append_target_property(
${target} "PROJECT_OPTIONS_${property}_DEPENDENCIES" "${args_${property}}"
set_property(TARGET ${target}
APPEND
PROPERTY "PROJECT_OPTIONS_${property}_DEPENDENCIES"
"${args_${property}}"
)
endmacro()

Expand Down
Loading