mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
commit
0a9368fc70
@ -1,10 +1,11 @@
|
||||
cmake_minimum_required ( VERSION 2.8 )
|
||||
cmake_minimum_required ( VERSION 2.8.5 )
|
||||
project ( "i2pd" )
|
||||
|
||||
# configurale options
|
||||
option(WITH_AESNI "Use AES-NI instructions set" OFF)
|
||||
option(WITH_HARDENING "Use hardening compiler flags" OFF)
|
||||
option(WITH_LIBRARY "Build library" ON)
|
||||
option(WITH_BINARY "Build binary" ON)
|
||||
option(WITH_STATIC "Static build" OFF)
|
||||
|
||||
# paths
|
||||
@ -140,25 +141,32 @@ message(STATUS "Options:")
|
||||
message(STATUS " AESNI : ${WITH_AESNI}")
|
||||
message(STATUS " HARDENING : ${WITH_HARDENING}")
|
||||
message(STATUS " LIBRARY : ${WITH_LIBRARY}")
|
||||
message(STATUS " BINARY : ${WITH_BINARY}")
|
||||
message(STATUS " STATIC BUILD : ${WITH_STATIC}")
|
||||
message(STATUS "---------------------------------------")
|
||||
|
||||
add_executable ( ${PROJECT_NAME} ${COMMON_SRC} ${DAEMON_SRC})
|
||||
#Handle paths nicely
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if (WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-z relro -z now" )
|
||||
if (WITH_BINARY)
|
||||
add_executable ( "${PROJECT_NAME}-bin" ${COMMON_SRC} ${DAEMON_SRC})
|
||||
set_target_properties("${PROJECT_NAME}-bin" PROPERTIES OUTPUT_NAME "${PROJECT_NAME}")
|
||||
|
||||
if (WITH_HARDENING AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set_target_properties("${PROJECT_NAME}-bin" PROPERTIES LINK_FLAGS "-z relro -z now" )
|
||||
endif ()
|
||||
|
||||
if (WITH_STATIC)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set_target_properties("${PROJECT_NAME}-bin" PROPERTIES LINK_FLAGS "-static" )
|
||||
endif ()
|
||||
|
||||
target_link_libraries( "${PROJECT_NAME}-bin" ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
||||
|
||||
install(TARGETS "${PROJECT_NAME}-bin" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
endif ()
|
||||
|
||||
if (WITH_STATIC)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-static" )
|
||||
endif ()
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
|
||||
|
||||
install(TARGETS i2pd RUNTIME DESTINATION "bin")
|
||||
|
||||
if (WITH_LIBRARY)
|
||||
add_library("lib${PROJECT_NAME}" SHARED ${COMMON_SRC} ${LIBRARY_SRC})
|
||||
install(TARGETS "lib${PROJECT_NAME}" LIBRARY DESTINATION "lib")
|
||||
add_library(${PROJECT_NAME} SHARED ${COMMON_SRC} ${LIBRARY_SRC})
|
||||
install(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
|
||||
endif ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user