Commit 906f0cbb authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Modernise configuration

parent 02f43738
......@@ -8,35 +8,45 @@
# that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge.
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
if(NOT BLC_PROGRAM_LOADED)
set(BLC_PROGRAM_LOADED "LOADED" PARENT_SCOPE)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_MACOSX_RPATH 0) #avoid warning in MACOSX
get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME) #The name of the project is the basename of the directory
project(${PROJECT_NAME})
project(blc_program)
add_definitions(-Wall -Wextra -Wno-multichar)
add_subdirectory(${BLAAR_DIR}/blc_core blc_core)
find_package(blc_core REQUIRED)
#source files
set(sources src/blc_program.cpp src/blc_command.cpp)
add_library(blc_program SHARED ${sources})
add_definitions(${BL_DEFINITIONS})
include_directories(include ${BL_INCLUDE_DIRS})
target_link_libraries(blc_program ${BL_LIBRARIES})
add_subdirectory(exclude_from_all EXCLUDE_FROM_ALL)
#shared lib
add_library(${PROJECT_NAME} SHARED ${sources})
target_link_libraries(${PROJECT_NAME} ${BL_LIBRARIES})
#static lib
add_library(static_${PROJECT_NAME} STATIC ${sources})
#Both librairies have the same name only the extension will change.
set_target_properties(static_${PROJECT_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
#Add a target to generate documentation
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/doxyfile.in doxyfile.doxy) #Replace the CMAKE variables in the Doxyfile
add_custom_target(doc_${PROJECT_NAME} ${DOXYGEN_EXECUTABLE} doxyfile.doxy COMMENT "Generating API documentation for ${PROJECT_NAME}" VERBATIM)
else()
message("You need to install doxygen to generate the doc.")
endif()
#Describe where are the includes
set(BL_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${BL_INCLUDE_DIRS} PARENT_SCOPE)
set(BL_LIBRARIES blc_program ${BLC_LIBRARIES} PARENT_SCOPE)
install(DIRECTORY include/ DESTINATION include/blc)
install(TARGETS blc_program DESTINATION lib/blc)
#Describe what will be to install or in the package by default the prefix (CMAKE_INSTALL_PREFIX) is '/usr/’
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
install(TARGETS ${PROJECT_NAME} static_${PROJECT_NAME} DESTINATION lib)
install(FILES ${PROJECT_NAME}-config.cmake DESTINATION share/${PROJECT_NAME})
#Package
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Arnaud Blanchard")
include(CPack)
endif()
# Copyright ETIS — ENSEA, Université de Cergy-Pontoise, CNRS (2011 - 2016)
# Author: Arnaud Blanchard
# Author: Arnaud Blanchard (November 2016)
#
# This software is governed by the CeCILL v2.1 license under French law and abiding by the rules of distribution of free software.
# You can use, modify and/ or redistribute the software under the terms of the CeCILL v2.1 license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info".
# As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license,
......@@ -9,24 +10,15 @@
# Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured  and, more generally, to use and operate it in the same conditions as regards security.
# The fact that you are presently reading this means that you have had knowledge of the CeCILL v2.1 license and that you accept its terms.
find_package(blc_core REQUIRED)
cmake_minimum_required(VERSION 2.6)
find_path(BLC_PROGRAM_INCLUDE_DIR blc_program.h PATH_SUFFIXES blc_program)
find_library(BLC_PROGRAM_LIBRARY blc_program )
#We are not in the same directory, we have to use absolute path to sources
foreach(source ${sources})
list(APPEND sources_abs ${PROJECT_SOURCE_DIR}/${source})
endforeach()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(blc_program DEFAULT_MSG BLC_PROGRAM_LIBRARY BLC_PROGRAM_INCLUDE_DIR)
add_library(static_blc_program STATIC ${sources_abs})
install(TARGETS static_blc_program DESTINATION lib/blc)
set_target_properties(static_blc_program PROPERTIES OUTPUT_NAME blc_program) #Both librairies have the same name only the extension will change
mark_as_advanced(BLC_PROGRAM_INCLUDE_DIR BLC_PROGRAM_LIBRARY )
#Add a target to generate documentation
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${PROJECT_SOURCE_DIR}/doxyfile.in doxyfile.doxy) #Replace the CMAKE variables in the Doxyfile
add_custom_target(doc_${PROJECT_NAME} ALL ${DOXYGEN_EXECUTABLE} doxyfile.doxy COMMENT "Generating API documentation for ${PROJECT_NAME}" VERBATIM )
else()
message("You need to install doxygen to generate the doc.")
endif()
\ No newline at end of file
set(BL_INCLUDE_DIRS ${BLC_PROGRAM_INCLUDE_DIR} ${BL_INCLUDE_DIRS} )
set(BL_LIBRARIES ${BLC_PROGRAM_LIBRARY} ${BL_LIBRARIES} )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment