curlpp icon indicating copy to clipboard operation
curlpp copied to clipboard

Export include path using target_include_directories

Open lemunozm opened this issue 7 years ago • 0 comments

Hi!

I was using your project from an external CMake project, and I notice that the directories of the target are not exported to other projects that include yours as add_subdirectory and then use target_link_libraries.

For example, in a basic CMake example using your library:

project(curlpp-example)
cmake_minimum_required(VERSION 3.5)

add_subdirectory("thirdparty/curlpp")
set(CMAKE_CXX_STANDARD 11)
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} PUBLIC curlpp)

I'm not be able to use the curlpp includes. (More exaclty, the gcc does not compile with the -Ipath-to-curlpp)

Adding the target_include_directories in your CMake library allows to add the curlpp includes path to the compilation when you link against the library at target_link_libraries.

I let you know the change in case you want to incorporate it into your project.

Regards.

lemunozm avatar Apr 09 '19 05:04 lemunozm