mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-03 04:10:05 -06:00
Add an `OPTIMIZE_DEPENDENCIES` target property and supporting `CMAKE_OPTIMIZE_DEPENDENCIES` variable to optionally enable pruning and flattening of outgoing dependencies from static libraries. Since they do not actually link, they only depend on side effects of their dependencies. Therefore we can drop dependencies that contribute no side effects.
17 lines
676 B
CMake
17 lines
676 B
CMake
function(write_targets)
|
|
set(_input "")
|
|
|
|
get_property(_targets DIRECTORY . PROPERTY BUILDSYSTEM_TARGETS)
|
|
foreach(_t IN LISTS _targets)
|
|
get_property(_type TARGET "${_t}" PROPERTY TYPE)
|
|
if(_type STREQUAL "SHARED_LIBRARY")
|
|
string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n")
|
|
string(APPEND _input "set(${_t}_TARGET_LINKER_FILE [==[$<TARGET_LINKER_FILE:${_t}>]==])\n")
|
|
elseif(_type STREQUAL "STATIC_LIBRARY")
|
|
string(APPEND _input "set(${_t}_TARGET_FILE [==[$<TARGET_FILE:${_t}>]==])\n")
|
|
endif()
|
|
endforeach()
|
|
|
|
file(GENERATE OUTPUT target_files.cmake CONTENT "${_input}" CONDITION $<CONFIG:Release>)
|
|
endfunction()
|