42 lines
1003 B
CMake
42 lines
1003 B
CMake
cmake_minimum_required(VERSION 3.18...3.28)
|
|
project(Property
|
|
VERSION 1.0
|
|
LANGUAGES CXX
|
|
)
|
|
|
|
# Prevent dummies from cluttering the source dir
|
|
if (PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
|
|
message(FATAL_ERROR "In-Source builds are not allowed")
|
|
endif()
|
|
|
|
# MODERN C++
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
|
# Maybe required Windows compat flag?
|
|
if (WIN32)
|
|
set(CMAKE_CXX_FLAGS "-municode")
|
|
endif()
|
|
|
|
file(GLOB_RECURSE Property_HEADERS "include/*.h" "include/*.hpp")
|
|
file(GLOB_RECURSE Property_SRC "src/*.c" "src/*.cpp")
|
|
|
|
if (UNIX)
|
|
add_library(Property SHARED ${Property_SRC})
|
|
endif()
|
|
|
|
if (WIN32)
|
|
add_library(Property STATIC ${Property_SRC})
|
|
endif()
|
|
|
|
target_include_directories(Property PUBLIC "include")
|
|
|
|
set_target_properties(Property PROPERTIES LINKER_LANGUAGE CXX)
|
|
|
|
install(TARGETS ${PROJECT_NAME} DESTINATION lib/${PROJECT_NAME})
|
|
|
|
install(FILES ${Property_HEADERS} DESTINATION include/${PROJECT_NAME})
|
|
|
|
add_executable(PropertyDemo main.cpp)
|
|
target_link_libraries(PropertyDemo Property)
|