test_embed_libevent_crosspl.../CMakeLists.txt

37 lines
917 B
CMake

cmake_minimum_required(VERSION 3.21)
set (PROJECT_VERSION "1.0")
project(telc VERSION ${PROJECT_VERSION})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_subdirectory(./lib/libevent)
add_subdirectory(./lib/serial)
include_directories(include)
include_directories(include/libevent)
include_directories(lib/serial/include)
add_library(${PROJECT_NAME} SHARED src/example.cpp)
set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# G++
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# MSVC
target_compile_options(${PROJECT_NAME} PRIVATE /EHsc /MTd /W2 /c)
# Set the DLLEXPORT variable to export symbols
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN_EXPORT)
endif()
target_link_libraries(${PROJECT_NAME} event serial)