check if libzip and bzip2 have been found before adding them to include_directories

This commit is contained in:
Patrick Brosi 2023-09-06 12:43:20 +02:00 committed by Patrick Brosi
parent 5c1ad4579f
commit 57ee83644e
2 changed files with 19 additions and 4 deletions

View file

@ -6,9 +6,6 @@ list(REMOVE_ITEM pfaedle_SRC ${pfaedle_main})
include_directories(
${PFAEDLE_INCLUDE_DIR}
SYSTEM ${BZIP2_INCLUDE_DIR}
SYSTEM ${LIBZIP_INCLUDE_DIR}
SYSTEM ${LIBZIP_CONF_INCLUDE_DIR}
)
configure_file (
@ -20,6 +17,15 @@ add_executable(pfaedle ${pfaedle_main})
add_library(pfaedle_dep ${pfaedle_SRC})
include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/xml/include/ ${PROJECT_SOURCE_DIR}/src/cppgtfs/src)
target_link_libraries(pfaedle pfaedle_dep util configparser ad_cppgtfs -lpthread ${LIBZIP_LIBRARY} ${BZIP2_LIBRARIES})
target_link_libraries(pfaedle pfaedle_dep util configparser ad_cppgtfs -lpthread)
if (LIBZIP_FOUND)
target_link_libraries(pfaedle ${LIBZIP_LIBRARY})
endif( LIBZIP_FOUND )
if (BZIP2_FOUND)
target_link_libraries(pfaedle ${BZIP2_LIBRARY})
endif( BZIP2_FOUND )
add_subdirectory(tests)