1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| cmake_minimum_required(VERSION 3.14)
set(MY_PROJECT_NAME mmbase)
project(${MY_PROJECT_NAME} LANGUAGES CXX)
message ("cmake:${PROJECT_NAME}")
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_DEBUG_POSTFIX -d)
set(MY_SOURCE_LIB_DIR "${PROJECT_SOURCE_DIR}/../lib/")
if (NOT CMAKE_BUILD_TYPE) set (CMAKE_BUILD_TYPE "Release") message ( STATUS "${PROJECT_NAME} no CMAKE_BUILD_TYPE selected, defaulting to ${CMAKE_BUILD_TYPE} " ) endif()
add_library(${PROJECT_NAME} SHARED logs.h logs.cpp )
target_compile_definitions(${PROJECT_NAME} PRIVATE MMBASE_LIBRARY=1)
if(MSVC) add_definitions("-DUNICODE" "-D_UNICODE") target_compile_options(${PROJECT_NAME} PUBLIC "/ZI") target_link_options(${PROJECT_NAME} PUBLIC "/INCREMENTAL") endif()
if (WIN32) add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<$<CONFIG:Debug>:debug/${PROJECT_NAME}-d.lib>" "$<$<CONFIG:Release>:release/${PROJECT_NAME}.lib>" "${MY_SOURCE_LIB_DIR}") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<$<CONFIG:Debug>:debug/${PROJECT_NAME}-d.dll>" "$<$<CONFIG:Release>:release/${PROJECT_NAME}.dll>" "${MY_SOURCE_LIB_DIR}") else() add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<$<CONFIG:Debug>:lib${PROJECT_NAME}-d.so>" "$<$<CONFIG:Release>:lib${PROJECT_NAME}.so>" "${MY_SOURCE_LIB_DIR}") endif()
|