56 lines
1.9 KiB
CMake
56 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.25)
|
|
|
|
project(Rum VERSION 1.0)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field -Wno-missing-field-initializers -Wno-c99-designator")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-private-field -Wno-missing-field-initializers -Wno-c99-designator")
|
|
|
|
file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/src/rum/*.cpp")
|
|
set(HEADERS "${CMAKE_SOURCE_DIR}/inc/rum")
|
|
|
|
include_directories("/usr/local/include")
|
|
|
|
add_library(rum OBJECT ${SOURCES})
|
|
set_target_properties(rum PROPERTIES POSITION_INDEPENDENT_CODE 1)
|
|
target_include_directories(rum PUBLIC "${CMAKE_SOURCE_DIR}/inc")
|
|
|
|
add_library(rum-static STATIC $<TARGET_OBJECTS:rum>)
|
|
set_target_properties(rum-static PROPERTIES OUTPUT_NAME rum)
|
|
target_include_directories(rum-static PUBLIC "${CMAKE_SOURCE_DIR}/inc")
|
|
|
|
add_library(rum-shared SHARED $<TARGET_OBJECTS:rum>)
|
|
set_target_properties(rum-shared PROPERTIES OUTPUT_NAME rum)
|
|
target_include_directories(rum-shared PUBLIC "${CMAKE_SOURCE_DIR}/inc")
|
|
|
|
if(WIN32)
|
|
target_link_libraries(rum-shared ws2_32)
|
|
target_link_libraries(rum-static ws2_32)
|
|
endif()
|
|
|
|
add_executable(example "${CMAKE_SOURCE_DIR}/src/server.cpp")
|
|
target_link_libraries(example rum-shared)
|
|
|
|
option(USE_FLAGS "Use flags in example" OFF)
|
|
if(USE_FLAGS)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_FLAGS")
|
|
target_link_directories(example PUBLIC "/usr/local/lib")
|
|
target_link_libraries(example flags-cpp)
|
|
endif()
|
|
|
|
install(TARGETS
|
|
rum-static
|
|
rum-shared
|
|
RUNTIME
|
|
COMPONENT Runtime
|
|
LIBRARY
|
|
COMPONENT Runtime
|
|
ARCHIVE
|
|
COMPONENT Development
|
|
)
|
|
install(DIRECTORY ${HEADERS} DESTINATION include COMPONENT Development)
|