* fix cmake build

This commit is contained in:
hagen 2014-12-11 07:57:46 +00:00
parent 5966113268
commit 342c87e15b

View File

@ -4,6 +4,7 @@ project ( "i2pd" )
# configurale options # configurale options
option(WITH_AESNI "Use AES-NI instructions set" OFF) option(WITH_AESNI "Use AES-NI instructions set" OFF)
option(WITH_HARDENING "Use hardening compiler flags" OFF) option(WITH_HARDENING "Use hardening compiler flags" OFF)
option(WITH_SHLIB "Build shared library" OFF)
# paths # paths
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" ) set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules" )
@ -117,7 +118,7 @@ if(NOT DEFINED CRYPTO++_INCLUDE_DIR)
endif() endif()
# load includes # load includes
include_directories( ${Boost_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR}) include_directories( ${Boost_INCLUDE_DIRS} ${CRYPTO++_INCLUDE_DIR} "${CMAKE_SOURCE_DIR}/..")
# show summary # show summary
message(STATUS "---------------------------------------") message(STATUS "---------------------------------------")
@ -129,6 +130,7 @@ message(STATUS "Install prefix: : ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Options:") message(STATUS "Options:")
message(STATUS " AESNI : ${WITH_AESNI}") message(STATUS " AESNI : ${WITH_AESNI}")
message(STATUS " HARDENING : ${WITH_HARDENING}") message(STATUS " HARDENING : ${WITH_HARDENING}")
message(STATUS " SHARED LIB : ${WITH_SHLIB}")
message(STATUS "---------------------------------------") message(STATUS "---------------------------------------")
add_executable ( ${PROJECT_NAME} ${SOURCES} ) add_executable ( ${PROJECT_NAME} ${SOURCES} )
@ -140,3 +142,9 @@ endif ()
target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) target_link_libraries( ${PROJECT_NAME} ${Boost_LIBRARIES} ${CRYPTO++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
install(TARGETS i2pd RUNTIME DESTINATION "bin") install(TARGETS i2pd RUNTIME DESTINATION "bin")
if (WITH_SHLIB)
list(APPEND SOURCES "${CMAKE_SOURCE_DIR}/api.cpp")
add_library("lib${PROJECT_NAME}" SHARED ${SOURCES})
install(TARGETS "lib${PROJECT_NAME}" LIBRARY DESTINATION "lib")
endif ()