From 130159ee10d2d60af3fb3dcaf28fdf619ac94651 Mon Sep 17 00:00:00 2001 From: vsande Date: Mon, 23 May 2016 17:57:42 +0200 Subject: [PATCH] Tests and examples compilation are now optional, to activate it use: cmake -DFPL_ENABLE_TESTS=ON -DFPL_ENABLE_EXAMPLES=ON $SOURCE_DIR First aproach (but not a real solution) to solve issue #16 --- .travis.yml | 2 +- CMakeLists.txt | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index ed7269a..f1a428c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,7 @@ install: before_script: - mkdir build - cd build - - cmake .. + - cmake -DFPL_ENABLE_TESTS=ON -DFPL_ENABLE_EXAMPLES=ON .. script: - ctest -VV -T Start -T Build -T Test -T Coverage diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d54620..5725cad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ SET(THIRDPARTY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/thirdparty) INCLUDE_DIRECTORIES(${CMAKE_Fortran_MODULE_DIRECTORY}) ################################################################# -# CONFIGURATION TYPES & BUILD MODE +# CONFIGURATION TYPES & BUILD MODE & BUILD_TESTS ################################################################# SET(CMAKE_CONFIGURATION_TYPES DEBUG RELEASE) @@ -45,6 +45,14 @@ IF(NOT CMAKE_BUILD_TYPE) SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS NONE DEBUG RELEASE) ENDIF(NOT CMAKE_BUILD_TYPE) +IF(NOT ${PROJECT_NAME}_ENABLE_TESTS) + OPTION(${PROJECT_NAME}_ENABLE_TESTS "Enable/disable tests compilation" OFF) +ENDIF(NOT ${PROJECT_NAME}_ENABLE_TESTS) + +IF(NOT ${PROJECT_NAME}_ENABLE_EXAMPLES) + OPTION(${PROJECT_NAME}_ENABLE_EXAMPLES "Enable/disable examples compilation" OFF) +ENDIF(NOT ${PROJECT_NAME}_ENABLE_EXAMPLES) + ################################################################# # List of external libraries ################################################################# @@ -167,6 +175,11 @@ ENDIF() ################################################################# ADD_SUBDIRECTORY(${LIB_PATH}) -ADD_SUBDIRECTORY(${TESTS_PATH}) -ADD_SUBDIRECTORY(${EXAMPLES_PATH}) +IF(${PROJECT_NAME}_ENABLE_TESTS) + ADD_SUBDIRECTORY(${TESTS_PATH}) +ENDIF() + +IF(${PROJECT_NAME}_ENABLE_EXAMPLES) + ADD_SUBDIRECTORY(${EXAMPLES_PATH}) +ENDIF()