Closed adepierre closed 4 years ago
Sure. I will try that.
mmm, I don't set any "include_directories" for the project. Currently to setup your target you have to do near the same is done by "find_package(OpenSSL)".
project(MyTarget)
...
# Init submodule openssl (https://github.com/janbar/openssl-cmake.git)
execute_process (COMMAND git submodule update --init --depth 1 -- openssl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/openssl
${CMAKE_CURRENT_BINARY_DIR}/openssl
EXCLUDE_FROM_ALL
)
set(OPENSSL_INCLUDE_DIR "${openssl_BINARY_DIR}/include" "${openssl_BINARY_DIR}")
include_directories(${OPENSSL_INCLUDE_DIR})
...
target_link_libraries(MyTarget crypto ssl)
Do you need I add the following ?
target_include_directories("${OPENSSL_BINARY_DIR}/include" "${OPENSSL_BINARY_DIR}")
Yes, if you use target_include_directories on crypto and ssl instead of include_directories the setup of a custom target would be simplified to:
project(MyTarget)
...
# Init submodule openssl (https://github.com/janbar/openssl-cmake.git)
execute_process (COMMAND git submodule update --init --depth 1 -- openssl WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(
${CMAKE_CURRENT_SOURCE_DIR}/openssl
${CMAKE_CURRENT_BINARY_DIR}/openssl
EXCLUDE_FROM_ALL
)
...
target_link_libraries(MyTarget crypto ssl)
as include directories would be automatically linked.
I made a commit to manage this. Can you test it please ?
It seems to be working like a charm, thank you!
Hi!
Thanks for this project which is quite useful.
Would it be possible to use target_include_directories to link the include folders to the targets? Like that the include directories are automatically linked to any target having ssl and/or crypto as dependency instead of having to set them manually.