mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 12:49:36 -06:00
Since commit e89ad0f94e (install: Allow installing targets created in
another directory, 2018-06-18, v3.13.0-rc1~407^2) we support calling
`install(TARGETS)` for targets created in another directory. However,
install generators are associated with the directory in which the call
to `install()` appears. This may not be the same directory in which the
target is defined. Record in each target the list of install generators
it has.
Fixes: #19546
38 lines
1.2 KiB
CMake
38 lines
1.2 KiB
CMake
enable_language(C)
|
|
|
|
include("${CMAKE_CURRENT_LIST_DIR}/include_test.cmake")
|
|
|
|
add_library(c_lib empty.c)
|
|
add_executable(c_exe empty.c)
|
|
target_link_libraries(c_exe PRIVATE c_lib)
|
|
|
|
add_library(c_shared_lib SHARED empty.c)
|
|
add_executable(c_shared_exe empty.c)
|
|
target_link_libraries(c_shared_exe PRIVATE c_shared_lib)
|
|
|
|
add_library(c_static_lib STATIC empty.c)
|
|
add_executable(c_static_exe empty.c)
|
|
target_link_libraries(c_static_exe PRIVATE c_static_lib)
|
|
|
|
add_subdirectory(cxx)
|
|
add_subdirectory(alias)
|
|
add_subdirectory(object)
|
|
add_subdirectory(imported)
|
|
add_subdirectory(custom)
|
|
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../FileAPIExternalSource" "${CMAKE_CURRENT_BINARY_DIR}/../FileAPIExternalBuild")
|
|
add_subdirectory(dir)
|
|
|
|
set_property(TARGET c_shared_lib PROPERTY LIBRARY_OUTPUT_DIRECTORY lib)
|
|
set_property(TARGET c_shared_lib PROPERTY RUNTIME_OUTPUT_DIRECTORY lib)
|
|
|
|
include(CheckIPOSupported)
|
|
check_ipo_supported(RESULT _ipo LANGUAGES C)
|
|
if(_ipo)
|
|
set_property(TARGET c_shared_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
|
|
set_property(TARGET c_shared_exe PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
|
|
set_property(TARGET c_static_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
|
|
file(WRITE "${CMAKE_BINARY_DIR}/ipo_enabled.txt" "")
|
|
endif()
|
|
|
|
install(TARGETS cxx_exe)
|