58 lines
1.6 KiB
CMake
58 lines
1.6 KiB
CMake
# ------------------------------
|
|
# cmake project
|
|
# ------------------------------
|
|
cmake_minimum_required(VERSION 4.1.0)
|
|
project(seallib LANGUAGES CXX)
|
|
|
|
# ------------------------------
|
|
# options
|
|
# ------------------------------
|
|
option(SEALLIB_ASSERT "Use assert library" OFF)
|
|
option(SEALLIB_EVENTS "Use events library" OFF)
|
|
option(SEALLIB_LOG "Use log library" OFF)
|
|
option(SEALLIB_VFS "Use virtual filesystem library" OFF)
|
|
|
|
option(SEALLIB_TEST "Build test project" OFF)
|
|
|
|
# enable all on test
|
|
if (SEALLIB_TEST)
|
|
set(ALL_LIBS SEALLIB_ASSERT SEALLIB_EVENTS SEALLIB_LOG SEALLIB_VFS)
|
|
foreach(lib ${ALL_LIBS})
|
|
set(${lib} ON CACHE BOOL "" FORCE)
|
|
endforeach()
|
|
endif()
|
|
|
|
# ------------------------------
|
|
# lib
|
|
# ------------------------------
|
|
set(SEALLIB_SOURCES "")
|
|
|
|
if (SEALLIB_ASSERT)
|
|
list(APPEND SEALLIB_SOURCES "src/lib/seallib/assert.cpp" "src/lib/seallib/assert.h")
|
|
endif()
|
|
|
|
if (SEALLIB_EVENTS)
|
|
list(APPEND SEALLIB_SOURCES "src/lib/seallib/events.cpp" "src/lib/seallib/events.h")
|
|
endif()
|
|
|
|
if (SEALLIB_LOG)
|
|
list(APPEND SEALLIB_SOURCES "src/lib/seallib/log.h")
|
|
endif()
|
|
|
|
if (SEALLIB_VFS)
|
|
list(APPEND SEALLIB_SOURCES "src/lib/seallib/vfs.cpp" "src/lib/seallib/vfs.h")
|
|
endif()
|
|
|
|
add_library(seallib STATIC ${SEALLIB_SOURCES})
|
|
target_include_directories(seallib PUBLIC src/lib)
|
|
|
|
# ------------------------------
|
|
# test
|
|
# ------------------------------
|
|
if (SEALLIB_TEST)
|
|
file(GLOB_RECURSE SEALLIB_TEST_SOURCES CONFIGURE_DEPENDS "src/test/*.h" "src/test/*.cpp")
|
|
add_executable(seallib-test ${SEALLIB_TEST_SOURCES})
|
|
target_include_directories(seallib-test PRIVATE "src/test")
|
|
target_link_libraries(seallib-test PRIVATE seallib)
|
|
endif()
|