mi024

College project master 1 "Projet IAD"
git clone https://esimon.eu/repos/mi024.git
Log | Files | Refs | README

commit 33b7f5084a3aab0be87ad6be3ad7a13168a3a649
parent 413128904fe547a406986c25fe940a7b3d480993
Author: Étienne Simon <etienne.jl.simon@gmail.com>
Date:   Sun,  5 May 2013 12:54:38 +0200

Improving CMakeLists.txt's.

Diffstat:
MCMakeLists.txt | 52+++++++++++++++++++++++++++++-----------------------
Mdoc/CMakeLists.txt | 10+++++++---
2 files changed, 36 insertions(+), 26 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt @@ -1,40 +1,46 @@ cmake_minimum_required(VERSION 2.8) project(MI014S7) -find_package(CUDA REQUIRED) +find_package(CUDA) find_package(Boost COMPONENTS unit_test_framework) -find_package(Boost COMPONENTS serialization program_options REQUIRED) +find_package(Boost COMPONENTS serialization program_options) find_package(Doxygen) find_package(LATEX) -set(WALFU_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../WALFU" CACHE PATH "Path to the WALFU directory") - set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/scripts" ${CMAKE_MODULE_PATH}) +set(COMPILE_PROGRAMS (${CUDA_FOUND} AND ${Boost_FOUND})) -set(WALFU_INCLUDE_DIRS ${WALFU_DIR} ${WALFU_DIR}/Core ${WALFU_DIR}/nmlp) -set(WALFU_LIBRARY_DIRS ${WALFU_DIR}/Core ${WALFU_DIR}/nmlp) -set(SQLITE3_LIBRARY_DIRS ${WALFU_DIR}/sqlite) -set(SQLITE3_INCLUDE_DIRS ${WALFU_DIR}/sqlite) -set(SQLITE3_LIBRARY ${WALFU_DIR}/sqlite/liblib_sqlite.a) +if(${COMPILE_PROGRAMS}) + set(WALFU_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../WALFU" CACHE PATH "Path to the WALFU directory") -# Sqlite3 needs dl, which is not part of libc on Linux. -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set(SQLITE3_LIBRARY ${SQLITE3_LIBRARY} dl) -endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(WALFU_INCLUDE_DIRS ${WALFU_DIR} ${WALFU_DIR}/Core ${WALFU_DIR}/nmlp) + set(WALFU_LIBRARY_DIRS ${WALFU_DIR}/Core ${WALFU_DIR}/nmlp) + set(SQLITE3_LIBRARY_DIRS ${WALFU_DIR}/sqlite) + set(SQLITE3_INCLUDE_DIRS ${WALFU_DIR}/sqlite) + set(SQLITE3_LIBRARY ${WALFU_DIR}/sqlite/liblib_sqlite.a) -set(CUDA_PROPAGATE_HOST_FLAGS OFF) -if(CMAKE_COMPILER_IS_GNUCXX) - # CUDA is ill-formed in C++98/03 since it uses the `long long' type, `-std=c++0x' has to be used. - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++0x -pedantic-errors -Wno-non-template-friend") -endif(CMAKE_COMPILER_IS_GNUCXX) + # Sqlite3 needs dl, which is not part of libc on Linux. + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(SQLITE3_LIBRARY ${SQLITE3_LIBRARY} dl) + endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") -add_subdirectory(doc) -add_subdirectory(src) + set(CUDA_PROPAGATE_HOST_FLAGS OFF) + if(CMAKE_COMPILER_IS_GNUCXX) + # CUDA is ill-formed in C++98/03 since it uses the `long long' type, `-std=c++0x' has to be used. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++0x -pedantic-errors -Wno-non-template-friend") + endif(CMAKE_COMPILER_IS_GNUCXX) + add_subdirectory(src) +else(${COMPILE_PROGRAMS}) + message(STATUS "The programs can not be compiled, check the prerequisite.") +endif(${COMPILE_PROGRAMS}) + +add_subdirectory(doc) ################# # Tests # ################# -enable_testing() - -add_test(Serialization ${CMAKE_CURRENT_BINARY_DIR}/src/test_serialization) +if(${COMPILE_PROGRAMS}) + enable_testing() + add_test(Serialization ${CMAKE_CURRENT_BINARY_DIR}/src/test_serialization) +endif(${COMPILE_PROGRAMS}) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt @@ -5,7 +5,7 @@ set(LATEX_DOCUMENTS add_custom_target(doc) -if(LATEX_FOUND) +if(PDFLATEX_COMPILER) include(UseLATEX) foreach(LATEX_DOCUMENT ${LATEX_DOCUMENTS}) @@ -14,10 +14,14 @@ if(LATEX_FOUND) add_dependencies(doc ${DOCUMENT}_pdf) add_custom_command(TARGET ${DOCUMENT}_pdf POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${DOCUMENT}.pdf ${CMAKE_BINARY_DIR}/${DOCUMENT}.pdf VERBATIM) endforeach(LATEX_DOCUMENT) -endif(LATEX_FOUND) +else(PDFLATEX_COMPILER) + message(STATUS "The LaTeX documentation can not be compiled.") +endif(PDFLATEX_COMPILER) if(DOXYGEN_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(devdoc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) + add_custom_target(devdoc ${DOXYGEN_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation with Doxygen" VERBATIM) add_dependencies(doc devdoc) +else(DOXYGEN_FOUND) + message(STATUS "The developer documentation can not be compiled.") endif(DOXYGEN_FOUND)