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

@ -8,6 +8,15 @@ if (ZLIB_FOUND)
include_directories( ${ZLIB_INCLUDE_DIRS} ) include_directories( ${ZLIB_INCLUDE_DIRS} )
endif( ZLIB_FOUND ) endif( ZLIB_FOUND )
if (LIBZIP_FOUND)
include_directories( SYSTEM ${LIBZIP_INCLUDE_DIR} )
include_directories( SYSTEM ${LIBZIP_CONF_INCLUDE_DIR} )
endif( LIBZIP_FOUND )
if (BZIP2_FOUND)
include_directories( SYSTEM ${BZIP2_INCLUDE_DIR} )
endif( BZIP2_FOUND )
add_subdirectory(util) add_subdirectory(util)
add_subdirectory(pfaedle) add_subdirectory(pfaedle)
add_subdirectory(cppgtfs) add_subdirectory(cppgtfs)

View file

@ -6,9 +6,6 @@ list(REMOVE_ITEM pfaedle_SRC ${pfaedle_main})
include_directories( include_directories(
${PFAEDLE_INCLUDE_DIR} ${PFAEDLE_INCLUDE_DIR}
SYSTEM ${BZIP2_INCLUDE_DIR}
SYSTEM ${LIBZIP_INCLUDE_DIR}
SYSTEM ${LIBZIP_CONF_INCLUDE_DIR}
) )
configure_file ( configure_file (
@ -20,6 +17,15 @@ add_executable(pfaedle ${pfaedle_main})
add_library(pfaedle_dep ${pfaedle_SRC}) add_library(pfaedle_dep ${pfaedle_SRC})
include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/xml/include/ ${PROJECT_SOURCE_DIR}/src/cppgtfs/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) add_subdirectory(tests)