EntityComponentMetaSystem/src/CMakeLists.txt

76 lines
2.2 KiB
CMake
Raw Normal View History

2024-01-17 10:02:51 +00:00
cmake_minimum_required(VERSION 3.22)
2016-02-24 10:35:55 +00:00
project(EntityComponentSystem)
2016-02-25 03:08:02 +00:00
set(EntityComponentSystem_HEADERS
EC/Meta/Combine.hpp
2016-03-04 11:20:56 +00:00
EC/Meta/Contains.hpp
EC/Meta/ContainsAll.hpp
EC/Meta/ForEach.hpp
EC/Meta/IndexOf.hpp
EC/Meta/Matching.hpp
EC/Meta/Morph.hpp
EC/Meta/TypeList.hpp
EC/Meta/TypeListGet.hpp
EC/Meta/Meta.hpp
EC/Bitset.hpp
EC/Manager.hpp
2021-09-06 06:54:24 +00:00
EC/EC.hpp
EC/ThreadPool.hpp
)
2016-02-24 10:35:55 +00:00
set(WillFailCompile_SOURCES
test/WillFailCompileTest.cpp)
2021-09-07 03:09:02 +00:00
find_package(Threads REQUIRED)
2016-02-25 03:08:02 +00:00
add_library(EntityComponentSystem INTERFACE)
2021-09-07 03:09:02 +00:00
target_link_libraries(EntityComponentSystem INTERFACE ${CMAKE_THREAD_LIBS_INIT})
2016-08-27 04:32:32 +00:00
target_include_directories(EntityComponentSystem INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
2016-02-24 10:35:55 +00:00
2016-08-27 04:32:32 +00:00
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
2016-02-24 10:35:55 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
2016-02-24 10:35:55 +00:00
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -D NDEBUG")
target_compile_features(EntityComponentSystem INTERFACE cxx_std_14)
2016-02-24 10:35:55 +00:00
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug', none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release")
endif()
2016-08-27 04:32:32 +00:00
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/EC DESTINATION include)
2016-02-24 10:35:55 +00:00
2016-02-25 03:08:02 +00:00
find_package(GTest)
if(GTEST_FOUND)
set(UnitTests_SOURCES
test/MetaTest.cpp
test/ECTest.cpp
2021-09-06 06:54:24 +00:00
test/ThreadPoolTest.cpp
test/Main.cpp
)
2016-02-25 03:08:02 +00:00
add_executable(UnitTests ${UnitTests_SOURCES})
target_link_libraries(UnitTests EntityComponentSystem ${GTEST_LIBRARIES})
target_include_directories(UnitTests PUBLIC ${GTEST_INCLUDE_DIR})
target_compile_features(UnitTests PUBLIC cxx_std_14)
2016-02-25 03:08:02 +00:00
enable_testing()
add_test(NAME UnitTests COMMAND UnitTests)
endif()
add_executable(WillFailCompile ${WillFailCompile_SOURCES})
set_target_properties(WillFailCompile PROPERTIES
EXCLUDE_FROM_ALL True
EXCLUDE_FROM_DEFAULT_BUILD True)
add_test(NAME WillFailCompile_0
COMMAND ${CMAKE_COMMAND} --build . --target WillFailCompile --config $<CONFIGURATION>
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(WillFailCompile_0 PROPERTIES WILL_FAIL True)