epubgrep/src/CMakeLists.txt

51 lines
1.3 KiB
CMake

include(GNUInstallDirs)
configure_file("version.hpp.in" "version.hpp" @ONLY)
configure_file("fs-compat.hpp.in" "fs-compat.hpp" @ONLY)
# The library is only here for the tests.
add_library(${PROJECT_NAME}_lib STATIC)
file(GLOB_RECURSE sources_src *.cpp)
file(GLOB_RECURSE headers_src *.hpp)
list(REMOVE_ITEM sources_src "${CMAKE_CURRENT_SOURCE_DIR}/main.cpp")
target_sources(${PROJECT_NAME}_lib
PUBLIC "${sources_src}" "${headers_src}")
unset(sources_src)
unset(headers_src)
target_link_libraries(${PROJECT_NAME}_lib
PUBLIC
Boost::locale
Boost::program_options
Boost::regex
std::filesystem
fmt::fmt
termcolor::termcolor
Threads::Threads
m
pugixml::pugixml)
if(${CMAKE_VERSION} VERSION_LESS 3.17)
target_link_libraries(${PROJECT_NAME}_lib
PUBLIC ${LibArchive_LIBRARIES})
target_include_directories(${PROJECT_NAME}_lib
PUBLIC ${LibArchive_INCLUDE_DIRS})
else()
target_link_libraries(${PROJECT_NAME}_lib
PUBLIC LibArchive::LibArchive)
endif()
target_include_directories(${PROJECT_NAME}_lib
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
add_executable(${PROJECT_NAME} "main.cpp")
target_link_libraries(${PROJECT_NAME}
PRIVATE ${PROJECT_NAME}_lib)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")