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: before_script:
- pacman -Sy cmake --noconfirm --needed - pacman -Sy cmake --noconfirm --needed
script: 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) project(chessarbiter)
# Shared library # Shared library
add_library(chessarbiter SHARED src/Piece.cpp src/Board.cpp src/Fen.cpp src/ChessArbiter.cpp) add_library(chessarbiter STATIC src/Piece.cpp src/Board.cpp src/Fen.cpp src/ChessArbiter.cpp)
include_directories(src/) target_include_directories(chessarbiter PUBLIC src/)
# Includes
set(CHESSARBITER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src PARENT_SCOPE) # To be used by other projects with add_subdirectory()
# Unit tests # Unit tests
enable_testing() set(COMPILE_TESTS OFF CACHE BOOL "Should unit tests be compiled")
add_subdirectory(./tests) if(COMPILE_TESTS)
enable_testing()
add_subdirectory(./tests)
endif()