project-kyoku/CMakeLists.txt

41 lines
1.5 KiB
CMake

cmake_minimum_required(VERSION 3.13)
project(project-kyoku LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra -Wpedantic -g")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
include_directories(${CMAKE_SOURCE_DIR}/include)
file(GLOB_RECURSE SOURCES "src/main.cpp")
add_executable(project-kyoku ${SOURCES})
SET(CMAKE_INSTALL_PREFIX /)
# When new game modes appear, aggregate them into a ONE subdirectory
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/modes/classicmode/CMakeLists.txt")
add_subdirectory(src/modes/classicmode)
target_link_libraries(project-kyoku classicmode)
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/tools/CMakeLists.txt")
add_subdirectory(src/tools)
target_link_libraries(project-kyoku tools)
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/application/CMakeLists.txt")
add_subdirectory(src/application)
target_link_libraries(project-kyoku application)
endif()
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/impl/CMakeLists.txt")
add_subdirectory(src/impl)
target_link_libraries(project-kyoku impl)
endif()