Don't add include path for config.h to header-only libs

This causes CMake errors and CMake is acutally right, it makes
no sense because the config header is only available during build
but a header-only lib is not being built.
experiment/srcref_basic_cfg
Martchus 5 years ago
parent 2ec3df889f
commit d25265fee1
  1. 12
      cmake/modules/ConfigHeader.cmake

@ -55,8 +55,10 @@ configure_file(
)
# ensure generated include files can be included via #include "resources/config.h"
foreach(TARGET_NAME ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tests ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_testlib)
if(TARGET ${TARGET_NAME})
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
endif()
endforeach()
if(NOT META_HEADER_ONLY_LIB)
foreach(TARGET_NAME ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX} ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_tests ${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_testlib)
if(TARGET ${TARGET_NAME})
target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")
endif()
endforeach()
endif()

Loading…
Cancel
Save