Notes |
|
(0033603)
|
Brad King
|
2013-07-25 08:32
|
|
Imported targets were originally designed for importing from an existing installation of some external package so installing did not make sense at the time. Later this interaction with ExternalProject was invented.
ExternalProject_add supports an INSTALL_COMMAND step to use the external build-system's own install rules. If it doesn't have any then you could also use install(SCRIPT) or install(CODE) add custom install code for them.
|
|
|
(0033604)
|
Nikita Krupenko
|
2013-07-25 08:38
|
|
How can I pack this imported targets with CPack? To do so, I must use the install() command. |
|
|
(0033605)
|
Nikita Krupenko
|
2013-07-25 08:44
|
|
I also found one solution:
get_target_property(MYLIB_LOCATION mylib LOCATION)
install(FILES ${MYLIB_LOCATION} DESTINATION ...)
This works, but maybe install command can be improved to handle imported targets. |
|
|
(0033606)
|
Brad King
|
2013-07-25 08:53
|
|
Since the example includes
set_target_properties(mylib PROPERTIES IMPORTED_LOCATION ...)
where the "..." knows the location already you don't need to get the LOCATION property. |
|
|
(0039836)
|
Kishore Jonnalagadda
|
2015-11-05 01:39
|
|
This is also useful when including prebuilt library binaries in the project.
add_library(prebuilt STATIC IMPORTED)
set_property(TARGET prebuilt PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/libprebuilt.a)
install(TARGETS other_built_targets prebuilt
EXPORT project-export
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
Making prebuilt an imported target makes in convenient to use in the project and treats it further like any other target. |
|
|
(0040877)
|
Alex Turbov
|
2016-04-18 01:17
|
|
+1 for the last comment from Kishore Jonnalagadda!
I have exacly the same case now :( |
|
|
(0041062)
|
AleXoundOS
|
2016-05-12 15:09
|
|
+1 for Kishore Jonnalagadda's comment |
|
|
(0042326)
|
Kitware Robot
|
2016-06-10 14:29
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|