Browse Source

* use $CNAME instead hardcoded project name

master
Alex 'AdUser' Z 8 years ago
parent
commit
4693dd7cff
  1. 9
      CMakeLists.txt
  2. 2
      src/CMakeLists.txt
  3. 2
      src/backends/CMakeLists.txt
  4. 2
      src/filters/CMakeLists.txt
  5. 2
      src/sources/CMakeLists.txt

9
CMakeLists.txt

@ -45,6 +45,7 @@ message(STATUS "- prefix : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "- configs : ${CMAKE_INSTALL_FULL_SYSCONFDIR}") message(STATUS "- configs : ${CMAKE_INSTALL_FULL_SYSCONFDIR}")
message(STATUS "- binary : ${CMAKE_INSTALL_FULL_BINDIR}") message(STATUS "- binary : ${CMAKE_INSTALL_FULL_BINDIR}")
message(STATUS "- binary : ${CMAKE_INSTALL_FULL_SBINDIR}") message(STATUS "- binary : ${CMAKE_INSTALL_FULL_SBINDIR}")
message(STATUS "- plugins : ${CMAKE_INSTALL_FULL_LIBDIR}/${CNAME}")
message(STATUS "- data : ${CMAKE_INSTALL_FULL_DATAROOTDIR}") message(STATUS "- data : ${CMAKE_INSTALL_FULL_DATAROOTDIR}")
message(STATUS "- state : ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}") message(STATUS "- state : ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}")
message(STATUS "Build type : ${CMAKE_BUILD_TYPE}") message(STATUS "Build type : ${CMAKE_BUILD_TYPE}")
@ -62,17 +63,17 @@ add_subdirectory(src)
add_subdirectory(t) add_subdirectory(t)
set_property(DIRECTORY "t" PROPERTY COMPILE_FLAGS "-g;-ggdb;-Wall;-Wextra;-pedantic;-O0") set_property(DIRECTORY "t" PROPERTY COMPILE_FLAGS "-g;-ggdb;-Wall;-Wextra;-pedantic;-O0")
install(DIRECTORY "filters" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/f2b") install(DIRECTORY "filters" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${CNAME}")
file(GLOB_RECURSE CONFIGS "*.conf.in") file(GLOB_RECURSE CONFIGS "*.conf.in")
foreach(CONFIG ${CONFIGS}) foreach(CONFIG ${CONFIGS})
string(REPLACE ".conf.in" ".conf" GENERATED ${CONFIG}) string(REPLACE ".conf.in" ".conf" GENERATED ${CONFIG})
configure_file(${CONFIG} ${GENERATED}) configure_file(${CONFIG} ${GENERATED})
endforeach() endforeach()
install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/f2b" install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}"
FILES_MATCHING PATTERN "*.conf") FILES_MATCHING PATTERN "*.conf")
install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/f2b" install(DIRECTORY "configs/" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}"
FILES_MATCHING PATTERN "README.txt") FILES_MATCHING PATTERN "README.txt")
install(FILES "configs/f2b.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/f2b" install(FILES "configs/f2b.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/${CNAME}"
RENAME "f2b.conf.sample") RENAME "f2b.conf.sample")
add_custom_target("dist" COMMAND add_custom_target("dist" COMMAND

2
src/CMakeLists.txt

@ -28,7 +28,7 @@ set(SOURCES "strlcpy.c" "backend-test.c" "log.c" "config.c" "backend.c")
add_executable("f2b-backend-test" ${SOURCES}) add_executable("f2b-backend-test" ${SOURCES})
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(f2b "dl") target_link_libraries("f2b" "dl")
target_link_libraries("f2b-source-test" "dl") target_link_libraries("f2b-source-test" "dl")
target_link_libraries("f2b-filter-test" "dl") target_link_libraries("f2b-filter-test" "dl")
target_link_libraries("f2b-backend-test" "dl") target_link_libraries("f2b-backend-test" "dl")

2
src/backends/CMakeLists.txt

@ -25,7 +25,7 @@ if (WITH_IPSET AND IPSET_FOUND)
list(APPEND BACKENDS "ipset") list(APPEND BACKENDS "ipset")
endif () endif ()
set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/f2b/backends") set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/${CNAME}/backends")
foreach (BACKEND IN LISTS BACKENDS) foreach (BACKEND IN LISTS BACKENDS)
set_target_properties("b_${BACKEND}" PROPERTIES OUTPUT_NAME ${BACKEND}) set_target_properties("b_${BACKEND}" PROPERTIES OUTPUT_NAME ${BACKEND})
install(TARGETS "b_${BACKEND}" LIBRARY DESTINATION ${LIB_PATH}) install(TARGETS "b_${BACKEND}" LIBRARY DESTINATION ${LIB_PATH})

2
src/filters/CMakeLists.txt

@ -12,7 +12,7 @@ if (WITH_PCRE AND PCRE_FOUND)
list(APPEND FILTERS "pcre") list(APPEND FILTERS "pcre")
endif () endif ()
set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/f2b/filters") set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/${CNAME}/filters")
foreach (FILTER IN LISTS FILTERS) foreach (FILTER IN LISTS FILTERS)
set_target_properties("f_${FILTER}" PROPERTIES OUTPUT_NAME ${FILTER}) set_target_properties("f_${FILTER}" PROPERTIES OUTPUT_NAME ${FILTER})
install(TARGETS "f_${FILTER}" LIBRARY DESTINATION ${LIB_PATH}) install(TARGETS "f_${FILTER}" LIBRARY DESTINATION ${LIB_PATH})

2
src/sources/CMakeLists.txt

@ -21,7 +21,7 @@ if (WITH_REDIS AND REDIS_FOUND)
list(APPEND SOURCES "redis") list(APPEND SOURCES "redis")
endif () endif ()
set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/f2b/sources") set(LIB_PATH "${CMAKE_INSTALL_LIBDIR}/${CNAME}/sources")
foreach (SOURCE IN LISTS SOURCES) foreach (SOURCE IN LISTS SOURCES)
set_target_properties("s_${SOURCE}" PROPERTIES OUTPUT_NAME ${SOURCE}) set_target_properties("s_${SOURCE}" PROPERTIES OUTPUT_NAME ${SOURCE})
install(TARGETS "s_${SOURCE}" LIBRARY DESTINATION ${LIB_PATH}) install(TARGETS "s_${SOURCE}" LIBRARY DESTINATION ${LIB_PATH})

Loading…
Cancel
Save