Get rid of relative include paths

* Use target_include_directories to specify include paths
* Specify project root (parent of rtgui and rtengine) as include path
* Replace relative includes with normal includes
This commit is contained in:
Daniel Gao
2024-11-16 17:20:02 -05:00
parent bc2fbfad66
commit 711f274403
212 changed files with 358 additions and 342 deletions

View File

@@ -224,8 +224,6 @@ if(NOT WITH_SYSTEM_KLT)
set(KLT_LIBRARIES)
endif()
include_directories(BEFORE "${CMAKE_CURRENT_BINARY_DIR}")
add_library(rtengine STATIC "${RTENGINESOURCEFILES}")
add_dependencies(rtengine UpdateInfo)
@@ -237,6 +235,18 @@ endif()
set_target_properties(rtengine PROPERTIES COMPILE_FLAGS "${RTENGINE_CXX_FLAGS}")
target_include_directories(rtengine
PUBLIC
# Other libraries should use #include "rtengine/header.h"
${PROJECT_SOURCE_DIR}
PRIVATE
# Subdirectories that are not libraries themselves should be included
# like #include "your_subdirectory/header.h"
${CMAKE_CURRENT_SOURCE_DIR}
)
# UpdateInfo creates "rtgui/version.h"
target_include_directories(rtengine BEFORE PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(rtengine
${EXPAT_LIBRARIES}
${EXTRA_LIB}