Hi,
I'm using ExternalProject_Add() to build OpenSLL library. After
install step I have following artifacts available:
* libcrypto.a
* libssl.a
* include/openssl/*.h
I wonder, what is the "canonical" way to make those artifacts
available for other targets in the project?
FindPackage style thing with OPENSSL_LIBRARIES and OPENSSL_INCLUDE_DIR
variables will not work, because OpenSSL target and executable that
uses it are on the same level (I think using CACHE to propagate
variable value up is a dirty hack):
* src/openssl/CMakeLists.txt
* src/my_executable/CMakeLists.txt
Ideally I would like to use add_library() with target_include_directories() and
target_link_libraries(). But the only way to do that is to use
IMPORTED libraries, like that:
add_library(crypto STATIC IMPORTED GLOBAL)
add_dependencies(crypto openssl_external_project)
set_property(TARGET crypto PROPERTY INTERFACE_LINK_LIBRARIES
${OPENSSL_PREFIX}/lib/libcrypto.a)
set_property(TARGET crypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${OPENSSL_PREFIX}/include)
But then I get an error:
$ cmake ..
CMake Error in src/my_executable/CMakeLists.txt:
Imported target "crypto" includes non-existent path
"<...>/build.dir/src/openssl/openssl-1.0.2.install/include"
Obviously, that happens because include directory was not created yet
(it will after make).
I understand that from general CMake standpoint - IMPORTED libraries
are something that already exists and not part of the build. But then
I don't understand how this ExternalProject_Add thing is supposed to
be used.
Any ideas what I'm doing wrong?
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake