Switch to STATIC library and improve CMake integration

This commit is contained in:
Loic Guegan 2023-05-02 18:27:46 +02:00
parent 27116f3b15
commit 987bf4b2f2
2 changed files with 8 additions and 8 deletions

View file

@ -3,4 +3,4 @@ archlinux:
before_script:
- pacman -Sy cmake --noconfirm --needed
script:
- mkdir build && cd build && cmake ../ && make && ctest
- mkdir build && cd build && cmake -DCOMPILE_TESTS:BOOL=ON ../ && make && ctest

View file

@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 3.10)
project(chessarbiter)
# Shared library
add_library(chessarbiter SHARED src/Piece.cpp src/Board.cpp src/Fen.cpp src/ChessArbiter.cpp)
include_directories(src/)
# Includes
set(CHESSARBITER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE) # To be used by other projects with add_subdirectory()
add_library(chessarbiter STATIC src/Piece.cpp src/Board.cpp src/Fen.cpp src/ChessArbiter.cpp)
target_include_directories(chessarbiter PUBLIC src/)
# Unit tests
enable_testing()
add_subdirectory(./tests)
set(COMPILE_TESTS OFF CACHE BOOL "Should unit tests be compiled")
if(COMPILE_TESTS)
enable_testing()
add_subdirectory(./tests)
endif()