From 987bf4b2f2e9cf3ed20c5e39e308e714c0127fc6 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Tue, 2 May 2023 18:27:46 +0200 Subject: [PATCH] Switch to STATIC library and improve CMake integration --- .gitlab-ci.yml | 2 +- CMakeLists.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 014eeb4..f31c373 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index c27724b..9691335 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() \ No newline at end of file