rising-gods/gelfcpp

CMake Error when integrating in my project

Closed this issue · 0 comments

Hi !
Thank you for your work.

I do have a project in which i'm creating a static library.
In my CMakeLists.txt file, i'm adding the following as per the documentation

set(GELFCPP_AS_SUBPROJECT 1)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/thirdparty/gelfcpp)

then modyfing my targets

target_link_libraries(nt PRIVATE Threads::Threads gelfcpp restc-cpp ssl crypto z boost_iostreams boost_log ${Boost_LIBRARIES})

target_include_directories( nt PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)


install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/nt/log.h ${CMAKE_CURRENT_SOURCE_DIR}/include/nt/dcs.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/nt)

install(TARGETS nt gelfcpp gelfcpp_boost gelfcpp_rapidjson EXPORT my_export DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nt)

install(EXPORT my_export FILE nt-config.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/nt)

but i have the following error

CMAKE_INSTALL_PREFIX = /usr/local
-- Configuring done
CMake Error in nt/thirdparty/gelfcpp/CMakeLists.txt:
  Target "gelfcpp" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/home/pierre/Documents/Git/Libnt/nt/thirdparty/gelfcpp/include"

  which is prefixed in the source directory.


CMake Error in nt/thirdparty/gelfcpp/dep/rapidjson/CMakeLists.txt:
  Target "gelfcpp_rapidjson" INTERFACE_INCLUDE_DIRECTORIES property contains
  path:

    "/home/pierre/Documents/Git/Libnt/nt/thirdparty/gelfcpp/dep/rapidjson/rapidjson/include"

  which is prefixed in the source directory.


CMake Error in nt/thirdparty/gelfcpp/CMakeLists.txt:
  Target "gelfcpp" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/home/pierre/Documents/Git/Libnt/nt/thirdparty/gelfcpp/include"

  which is prefixed in the source directory.


CMake Error in nt/thirdparty/gelfcpp/dep/rapidjson/CMakeLists.txt:
  Target "gelfcpp_rapidjson" INTERFACE_INCLUDE_DIRECTORIES property contains
  path:

    "/home/pierre/Documents/Git/Libnt/nt/thirdparty/gelfcpp/dep/rapidjson/rapidjson/include"

  which is prefixed in the source directory.

Can you please help me on this ?
(i'm new to Cmake)

Regards,
Pierre