Library curlpp in it’s pkg-config --cflags has:
-Iinclude -I/usr/include/x86_64-linux-gnu
cmake rejects relative -Iinclude:
CMake Error in src/CMakeLists.txt:
Target "PkgConfig::CURLPP" contains relative path in its
INTERFACE_INCLUDE_DIRECTORIES:
"include"
I tried to remove all single include and print all the vars but still getting the same error.
How to get rid of -Iinclude
?
Minimal project:
project(test)
cmake_minimum_required(VERSION 3.10)
include(FindPkgConfig)
pkg_check_modules(CURLPP REQUIRED IMPORTED_TARGET curlpp)
set(mylibs)
list(APPEND mylibs PkgConfig::CURLPP)
list(REMOVE_ITEM CURLPP_CFLAGS "-Iinclude")
list(REMOVE_ITEM CURLPP_STATIC_INCLUDE_DIRS "-Iinclude")
list(POP_FRONT CURLPP_STATIC_CFLAGS)
list(POP_FRONT CURLPP_STATIC_INCLUDE_DIRS)
list(REMOVE_ITEM CURLPP_INCLUDE_DIRS include)
list(REMOVE_ITEM CURLPP_INCLUDEDIR include)
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
add_executable(test test.c)
target_link_libraries(test ${mylibs})