2018-07-26 07:44:19 +03:00
|
|
|
file(GLOB SOURCES_CEDAR "*.c")
|
|
|
|
file(GLOB HEADERS_CEDAR "*.h")
|
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
if(WIN32)
|
|
|
|
enable_language(CXX)
|
|
|
|
file(GLOB SOURCES_CEDAR_CPP "*.cpp")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
add_library(cedar STATIC ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
|
|
|
|
else()
|
|
|
|
add_library(cedar SHARED ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
|
|
|
|
endif()
|
2018-07-26 07:44:19 +03:00
|
|
|
|
|
|
|
set_target_properties(cedar
|
|
|
|
PROPERTIES
|
2018-10-20 14:12:49 +03:00
|
|
|
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
|
|
|
|
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
|
|
|
|
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
|
2018-07-26 07:44:19 +03:00
|
|
|
)
|
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
if(WIN32)
|
2018-11-18 06:18:42 +03:00
|
|
|
set_target_properties(cedar
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_PDB_NAME "cedar"
|
|
|
|
COMPILE_PDB_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
|
|
|
|
)
|
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
target_include_directories(cedar PRIVATE winpcap)
|
|
|
|
endif()
|
2018-07-31 12:49:55 +03:00
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
if(UNIX)
|
|
|
|
find_library(LIB_READLINE readline)
|
|
|
|
find_package(Curses REQUIRED)
|
2018-07-31 12:49:55 +03:00
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
target_link_libraries(cedar PRIVATE ${LIB_READLINE} ${CURSES_LIBRARIES})
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
|
|
|
target_link_libraries(cedar PRIVATE mayaqua pcap)
|
|
|
|
endif()
|
2018-07-26 07:44:19 +03:00
|
|
|
endif()
|
2018-08-27 06:50:40 +03:00
|
|
|
|
|
|
|
# Version
|
|
|
|
add_definitions(-DCEDAR_VERSION_MAJOR=${PROJECT_VERSION_MAJOR} -DCEDAR_VERSION_MINOR=${PROJECT_VERSION_MINOR} -DCEDAR_VERSION_BUILD=${PROJECT_VERSION_PATCH})
|
|
|
|
|
|
|
|
# Builder
|
|
|
|
if(UNIX)
|
|
|
|
add_definitions(-DBUILDER_NAME="$ENV{USER}")
|
|
|
|
elseif(WIN32)
|
|
|
|
add_definitions(-DBUILDER_NAME="$ENV{USERNAME}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
cmake_host_system_information(RESULT BUILDER_HOSTNAME QUERY HOSTNAME)
|
|
|
|
|
|
|
|
add_definitions(-DBUILD_PLACE="${BUILDER_HOSTNAME}")
|
|
|
|
|
2018-11-27 07:26:21 +03:00
|
|
|
# Remove leading 0 from date and time
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_DAY "${DATE_DAY}")
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_MONTH "${DATE_MONTH}")
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_YEAR "${DATE_YEAR}")
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_HOUR "${TIME_HOUR}")
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_MINUTE "${TIME_MINUTE}")
|
|
|
|
string(REGEX REPLACE "^0([^ ]*)" "\\1" BUILD_SECOND "${TIME_SECOND}")
|
2018-08-27 06:50:40 +03:00
|
|
|
|
|
|
|
add_definitions(-DBUILD_DATE_D=${BUILD_DAY} -DBUILD_DATE_M=${BUILD_MONTH} -DBUILD_DATE_Y=${BUILD_YEAR})
|
|
|
|
add_definitions(-DBUILD_DATE_HO=${BUILD_HOUR} -DBUILD_DATE_MI=${BUILD_MINUTE} -DBUILD_DATE_SE=${BUILD_SECOND})
|
2018-10-20 14:12:49 +03:00
|
|
|
|
2018-10-24 20:23:07 +03:00
|
|
|
if(UNIX)
|
|
|
|
install(TARGETS cedar
|
|
|
|
COMPONENT "common"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
|
|
|
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
|
|
|
)
|
|
|
|
endif()
|