Create CMI interface

This commit is contained in:
Loic Guegan 2023-01-18 21:53:37 +01:00
parent 5d3004e555
commit 8fd85102ab
6 changed files with 889 additions and 89 deletions

22
CMakeLists.txt Normal file
View file

@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.18)
project(ChessMoveInterface)
# Includes
set(CMI_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/includes) # For conveniance
set(CMI_INCLUDE_DIR ${CMI_INCLUDE_DIR} PARENT_SCOPE) # To be used by other projects with add_subdirectory()
file(MAKE_DIRECTORY ${CMI_INCLUDE_DIR})
# Copy all includes
file(GLOB_RECURSE HEADER_FILES src/*.hpp)
foreach(FILE ${HEADER_FILES})
file(RELATIVE_PATH FILE_SUBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src ${FILE})
configure_file(${FILE} ${CMI_INCLUDE_DIR}/${FILE_SUBDIR} COPYONLY)
endforeach(FILE ${HEADER_FILES})
# Add target if not exists
# This way ChessMoveInterface can be used in multiple submodules
include_directories(src)
file(GLOB_RECURSE SRC_CPP_FILES src/*.cpp)
if(NOT TARGET ChessMoveInterface)
add_library(ChessMoveInterface SHARED ${SRC_CPP_FILES})
endif()