Prefer target_include_directories
When libtiff is included in a super project via a simple `add_subdirectory(libtiff)`, this way the `tiff` library target has all the necessary information to build against it. Note: The BUILD_INTERFACE generator expression feature requires at least CMake v2.8.11 if I'm correct.
This commit is contained in:
parent
1dcf5303e1
commit
0b05f43209
@ -110,12 +110,14 @@ else()
|
|||||||
list(APPEND tiff_SOURCES tif_unix.c)
|
list(APPEND tiff_SOURCES tif_unix.c)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${TIFF_INCLUDES})
|
|
||||||
|
|
||||||
add_library(tiff ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS}
|
add_library(tiff ${tiff_SOURCES} ${tiff_HEADERS} ${nodist_tiff_HEADERS}
|
||||||
${tiff_port_SOURCES} libtiff.def)
|
${tiff_port_SOURCES} libtiff.def)
|
||||||
|
target_include_directories(tiff
|
||||||
|
PUBLIC
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||||
|
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
|
||||||
|
${TIFF_INCLUDES}
|
||||||
|
)
|
||||||
target_link_libraries(tiff ${TIFF_LIBRARY_DEPS})
|
target_link_libraries(tiff ${TIFF_LIBRARY_DEPS})
|
||||||
set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION})
|
set_target_properties(tiff PROPERTIES SOVERSION ${SO_COMPATVERSION})
|
||||||
if(NOT CYGWIN)
|
if(NOT CYGWIN)
|
||||||
|
Loading…
Reference in New Issue
Block a user