Skip to content

Commit

Permalink
CR #186
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Eilemann authored and Stefan Eilemann committed Aug 12, 2014
1 parent 2312c70 commit 54b0389
Show file tree
Hide file tree
Showing 35 changed files with 184 additions and 180 deletions.
2 changes: 1 addition & 1 deletion BuildConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

include(GitInfo)

install (PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/CMakeCache.txt" DESTINATION
install (PROGRAMS "${PROJECT_BINARY_DIR}/CMakeCache.txt" DESTINATION
share/${PROJECT_NAME}/CMake/BuildParams)

execute_process(COMMAND env OUTPUT_VARIABLE environment)
Expand Down
16 changes: 8 additions & 8 deletions Buildyard.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Buildyard. git add them to your project and then add to the top-level
# CMakeLists.txt:
# project(Foo)
# list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
# list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)
# include(Buildyard)
# if(BUILDYARD_STOP)
# return()
Expand All @@ -32,18 +32,18 @@ message(STATUS "Bootstrap Buildyard for missing${FIND_REQUIRED_FAILED}")
set(BUILDYARD_BOOTSTRAP ON)
include(GitExternal)

git_external("${CMAKE_CURRENT_BINARY_DIR}/Buildyard"
git_external("${PROJECT_BINARY_DIR}/Buildyard"
https://github.com/Eyescale/Buildyard.git master)

configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Buildyard/config.Buildyard/${PROJECT_NAME}.cmake"
configure_file("${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake"
"${PROJECT_BINARY_DIR}/Buildyard/config.Buildyard/${PROJECT_NAME}.cmake"
COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CMake/depends.txt"
"${CMAKE_CURRENT_BINARY_DIR}/Buildyard/config.Buildyard/depends.txt" COPYONLY)
configure_file("${PROJECT_SOURCE_DIR}/CMake/depends.txt"
"${PROJECT_BINARY_DIR}/Buildyard/config.Buildyard/depends.txt" COPYONLY)

set(BUILDYARD_TARGETS ${PROJECT_NAME})
add_subdirectory("${CMAKE_CURRENT_BINARY_DIR}/Buildyard" # source
"${CMAKE_CURRENT_BINARY_DIR}/Buildyard.bin" ) # binary
add_subdirectory("${PROJECT_BINARY_DIR}/Buildyard" # source
"${PROJECT_BINARY_DIR}/Buildyard.bin" ) # binary
if(MSVC)
message(STATUS "Build 00_Main->AllProjects to bootstrap and 00_Main->AllBuild after bootstrap\n")
else()
Expand Down
14 changes: 7 additions & 7 deletions Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if(COMMON_INCLUDED)
endif()
set(COMMON_INCLUDED 1)

if(CMAKE_INSTALL_PREFIX STREQUAL CMAKE_CURRENT_BINARY_DIR)
if(CMAKE_INSTALL_PREFIX STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR "Cannot install into build directory")
endif()

Expand All @@ -28,8 +28,8 @@ if(CMAKE_VERSION VERSION_LESS 2.8.8)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/2.8.8)
endif()

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake)
if(EXISTS ${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake)
include(${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.cmake)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/System.cmake)
include(GitInfo)
Expand Down Expand Up @@ -77,12 +77,12 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND NOT MSVC)
"${PROJECT_NAME} install prefix" FORCE)
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

if(NOT DOC_DIR)
set(DOC_DIR share/${PROJECT_NAME}/doc)
set(DOC_DIR share/${CMAKE_PROJECT_NAME}/doc)
endif()
if(NOT COMMON_PROJECT_DOMAIN)
set(COMMON_PROJECT_DOMAIN org.doxygen)
Expand Down
2 changes: 1 addition & 1 deletion CommonApplication.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function(COMMON_APPLICATION Name)
if(${NAME}_UI_FORMS)
qt4_wrap_ui(UI_SOURCES ${${NAME}_UI_FORMS})
list(APPEND SOURCES ${UI_SOURCES})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR})
endif()
if(${NAME}_RESOURCES)
qt4_add_resources(QRC_SOURCES ${LIVREGUI_RESOURCES})
Expand Down
8 changes: 4 additions & 4 deletions CommonCPPCTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
# ${NAME}_TEST_LABEL specifies an additional label.

if(NOT WIN32) # tests want to be with DLLs on Windows - no rpath
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
endif()

include_directories(${CMAKE_CURRENT_LIST_DIR}/cpp ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_LIST_DIR}/cpp ${PROJECT_SOURCE_DIR})

file(GLOB_RECURSE TEST_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.cpp)
file(GLOB_RECURSE TEST_FILES RELATIVE ${PROJECT_SOURCE_DIR} *.c *.cpp)
foreach(FILE ${EXCLUDE_FROM_TESTS})
list(REMOVE_ITEM TEST_FILES ${FILE})
endforeach()
Expand Down Expand Up @@ -82,7 +82,7 @@ if(TARGET run_cpp_tests)
else()
add_custom_target(run_cpp_tests
COMMAND ${CMAKE_CTEST_COMMAND} \${ARGS} DEPENDS ${ALL_CPP_TESTS}
WORKING_DIRECTORY ${${PROJECT_NAME}_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Running all cpp unit tests")
if(COVERAGE)
add_dependencies(run_cpp_tests lcov-clean)
Expand Down
8 changes: 4 additions & 4 deletions CommonCPack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
endif()

if(CMAKE_SYSTEM_NAME MATCHES "Linux")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.in.spec)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.in.spec
${CMAKE_CURRENT_SOURCE_DIR}/CMake/${PROJECT_NAME}.spec @ONLY)
if(EXISTS ${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.in.spec)
configure_file(${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.in.spec
${PROJECT_SOURCE_DIR}/CMake/${PROJECT_NAME}.spec @ONLY)
endif()

string(TOLOWER ${CPACK_PACKAGE_NAME} LOWER_PACKAGE_NAME_PREFIX)
Expand All @@ -42,7 +42,7 @@ set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE.txt)
if(NOT CPACK_PACKAGE_LICENSE)
set(CPACK_PACKAGE_LICENSE "LGPL")
message(STATUS "Using default ${CPACK_PACKAGE_LICENSE} package license")
Expand Down
6 changes: 6 additions & 0 deletions CommonCTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

include(CommonCPPCTest)

if(NOT TARGET tests)
add_custom_target(tests)
set_target_properties(tests PROPERTIES FOLDER "Tests")
endif()

if(COVERAGE)
coverage_report(run_cpp_tests)
# workaround: 'make test' does not build tests beforehand
Expand All @@ -13,3 +18,4 @@ else()
endif()

set_target_properties(${PROJECT_NAME}_tests PROPERTIES FOLDER "Tests")
add_dependencies(tests ${PROJECT_NAME}_tests)
20 changes: 10 additions & 10 deletions CommonCode.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

include(GitInfo)

set(OUTPUT_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
set(OUTPUT_INCLUDE_DIR ${PROJECT_BINARY_DIR}/include)
file(MAKE_DIRECTORY ${OUTPUT_INCLUDE_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_INCLUDE_DIR})
include_directories(BEFORE ${PROJECT_SOURCE_DIR} ${OUTPUT_INCLUDE_DIR})
if(NOT PROJECT_INCLUDE_NAME)
set(PROJECT_INCLUDE_NAME ${LOWER_PROJECT_NAME})
endif()
Expand All @@ -14,16 +14,16 @@ endif()
string(TOUPPER ${PROJECT_namespace} PROJECT_NAMESPACE)

configure_file(${CMAKE_CURRENT_LIST_DIR}/cpp/api.h
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/api.h @ONLY)
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/api.h @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/cpp/defines.h
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/defines.h @ONLY)
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/defines.h @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/cpp/version.h
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/version.h @ONLY)
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/version.h @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/cpp/version.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.cpp @ONLY)
${PROJECT_BINARY_DIR}/version.cpp @ONLY)

list(APPEND COMMON_INCLUDES
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/api.h
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/defines.h
${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/version.h)
list(APPEND COMMON_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version.cpp)
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/api.h
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/defines.h
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/version.h)
list(APPEND COMMON_SOURCES ${PROJECT_BINARY_DIR}/version.cpp)
11 changes: 5 additions & 6 deletions CommonLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function(COMMON_LIBRARY Name)
set(HEADERS ${${NAME}_HEADERS})
set(PUBLIC_HEADERS ${${NAME}_PUBLIC_HEADERS})
set(LINK_LIBRARIES ${${NAME}_LINK_LIBRARIES})
set(PROJECT_GENERATED_HEADER

set(PROJECT_GENERATED_HEADER
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/${PROJECT_INCLUDE_NAME}.in.h)

file(WRITE ${PROJECT_GENERATED_HEADER}
Expand All @@ -52,8 +52,7 @@ function(COMMON_LIBRARY Name)
endif()
endforeach()
file(APPEND ${PROJECT_GENERATED_HEADER} "#endif\n")
# note that the use of CMAKE_BINARY_DIR is intentional here
set(PROJECT_INCLUDE_HEADER
set(PROJECT_INCLUDE_HEADER
${PROJECT_BINARY_DIR}/include/${PROJECT_INCLUDE_NAME}/${PROJECT_INCLUDE_NAME}.h)

configure_file(
Expand Down Expand Up @@ -90,9 +89,9 @@ function(COMMON_LIBRARY Name)
endforeach()

if(MSVC)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug/${Name}.pdb
install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/${Name}.pdb
DESTINATION bin COMPONENT lib CONFIGURATIONS Debug)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/bin/RelWithDebInfo/${Name}.pdb
install(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/RelWithDebInfo/${Name}.pdb
DESTINATION bin COMPONENT lib CONFIGURATIONS RelWithDebInfo)
endif()

Expand Down
16 changes: 8 additions & 8 deletions Coverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if(ENABLE_COVERAGE)
if(LCOV AND GENHTML)
set(COVERAGE ON)
add_custom_target(lcov-clean
COMMAND ${LCOV} -q --directory ${CMAKE_CURRENT_BINARY_DIR} --zerocounters
COMMAND ${LCOV} -q --directory ${PROJECT_BINARY_DIR} --zerocounters
COMMENT "Resetting code coverage counters")
else()
set(COVERAGE_MISSING)
Expand Down Expand Up @@ -62,17 +62,17 @@ macro(COVERAGE_REPORT)
add_custom_target(lcov-gather
COMMAND ${LCOV} --directory . --capture --output-file lcov.info
COMMENT "Capturing code coverage counters"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS ${ARGV})
add_custom_target(lcov-remove
COMMAND ${LCOV} -q --remove lcov.info 'tests/*' '/usr/*' '/opt/*' '*.l' 'CMake/test/*' '*/install/*' '/Applications/Xcode.app/*' '${CMAKE_CURRENT_BINARY_DIR}/*' ${LCOV_EXCLUDE} --output-file lcov2.info
COMMAND ${LCOV} -q --remove lcov.info 'tests/*' '/usr/*' '/opt/*' '*.l' 'CMake/test/*' '*/install/*' '/Applications/Xcode.app/*' '${PROJECT_BINARY_DIR}/*' ${LCOV_EXCLUDE} --output-file lcov2.info
COMMENT "Cleaning up code coverage counters"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
DEPENDS lcov-gather)
add_custom_target(lcov-html
COMMAND ${GENHTML} -q ${COVERAGE_LIMITS} -o CoverageReport ${CMAKE_CURRENT_BINARY_DIR}/lcov2.info
COMMENT "Creating html coverage report, open ${CMAKE_CURRENT_BINARY_DIR}/doc/html/CoverageReport/index.html "
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html
COMMAND ${GENHTML} -q ${COVERAGE_LIMITS} -o CoverageReport ${PROJECT_BINARY_DIR}/lcov2.info
COMMENT "Creating html coverage report, open ${PROJECT_BINARY_DIR}/doc/html/CoverageReport/index.html "
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc/html
DEPENDS lcov-remove)
make_directory(${CMAKE_CURRENT_BINARY_DIR}/doc/html)
make_directory(${PROJECT_BINARY_DIR}/doc/html)
endmacro()
12 changes: 8 additions & 4 deletions CppcheckTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ if(NOT TARGET cppcheck_${PROJECT_NAME})
add_custom_target(cppcheck_${PROJECT_NAME})
endif()

if(NOT TARGET cppcheck)
add_custom_target(cppcheck DEPENDS cppcheck_${PROJECT_NAME})
endif()

function(add_cppcheck_sources _targetname)
if(CPPCHECK_FOUND)
set(_cppcheck_args -I ${CMAKE_CURRENT_SOURCE_DIR}
set(_cppcheck_args -I ${PROJECT_SOURCE_DIR}
--error-exitcode=2 --inline-suppr
--suppress=unmatchedSuppression --suppress=preprocessorErrorDirective
${CPPCHECK_EXTRA_ARGS})
Expand Down Expand Up @@ -128,7 +132,7 @@ function(add_cppcheck_sources _targetname)
${_cppcheck_args}
${_files}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}"
COMMENT
"${_targetname}_cppcheck: Running cppcheck on target ${_targetname}..."
VERBATIM)
Expand All @@ -142,7 +146,7 @@ function(add_cppcheck _name)
"add_cppcheck given a target name that does not exist: '${_name}' !")
endif()
if(CPPCHECK_FOUND)
set(_cppcheck_args -I ${CMAKE_CURRENT_SOURCE_DIR}
set(_cppcheck_args -I ${PROJECT_SOURCE_DIR}
--error-exitcode=2 --inline-suppr
--suppress=unmatchedSuppression --suppress=preprocessorErrorDirective
${CPPCHECK_EXTRA_ARGS})
Expand Down Expand Up @@ -204,7 +208,7 @@ function(add_cppcheck _name)
${_cppcheck_args}
${_files}
WORKING_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}"
COMMENT
"${_name}_cppcheck: Running cppcheck on target ${_name}..."
VERBATIM)
Expand Down
2 changes: 1 addition & 1 deletion CpplintTargets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function(add_cpplint _name)

add_custom_target(${_name}_cpplint
COMMAND ${CPPLINT_SCRIPT} ${_cpplint_args} ${_files}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
COMMENT "Running cpplint on ${_name}"
VERBATIM)
add_dependencies(cpplint ${_name}_cpplint)
Expand Down
28 changes: 14 additions & 14 deletions DoxygenRule.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# * DOXYGEN_EXTRA_FILES additional files to be copied to documentation,
# appended to HTML_EXTRA_FILES in Doxyfile
# * DOXYGEN_PROJECT_NAME the name to use in the documentation title. Defaults
# to PROJECT_NAME is not provided.
# to PROJECT_NAME if not provided.
# * DOXYGEN_MAINPAGE_MD markdown file to use as main page. See
# USE_MDFILE_AS_MAINPAGE doxygen documentation for details.
# * DOXYGIT_MAX_VERSIONS number of versions to keep in directory
Expand All @@ -23,8 +23,8 @@
#
# * doxygen runs doxygen after compiling and installing the project
# * doxygit runs doxygen and installs the documentation in
# CMAKE_CURRENT_SOURCE_DIR/../GIT_DOCUMENTATION_REPO or
# CMAKE_CURRENT_SOURCE_DIR/../GIT_ORIGIN_org
# PROJECT_SOURCE_DIR/../GIT_DOCUMENTATION_REPO or
# PROJECT_SOURCE_DIR/../GIT_ORIGIN_org

find_package(Doxygen)
if(NOT DOXYGEN_FOUND)
Expand Down Expand Up @@ -58,17 +58,17 @@ endif()
if(NOT DOXYGEN_CONFIG_FILE)
# Assuming there exists a Doxyfile and that needs configuring
configure_file(${CMAKE_CURRENT_LIST_DIR}/Doxyfile
${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
set(DOXYGEN_CONFIG_FILE ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile)
${PROJECT_BINARY_DIR}/doc/Doxyfile @ONLY)
set(DOXYGEN_CONFIG_FILE ${PROJECT_BINARY_DIR}/doc/Doxyfile)
endif()

add_custom_target(doxygen_install
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake
${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake_install.cmake
DEPENDS ${INSTALL_DEPENDS})

add_custom_target(doxygen_html
${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIG_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc
COMMENT "Generating API documentation using doxygen" VERBATIM
DEPENDS doxygen_install project_info)
if(COVERAGE)
Expand All @@ -78,29 +78,29 @@ else()
add_custom_target(doxygen DEPENDS doxygen_html)
endif()

make_directory(${CMAKE_CURRENT_BINARY_DIR}/doc/html)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html
make_directory(${PROJECT_BINARY_DIR}/doc/html)
install(DIRECTORY ${PROJECT_BINARY_DIR}/doc/html
DESTINATION ${DOC_DIR}/API
COMPONENT doc CONFIGURATIONS Release)

if(GIT_DOCUMENTATION_REPO)
set(GIT_DOCUMENTATION_DIR
${CMAKE_CURRENT_SOURCE_DIR}/../${GIT_DOCUMENTATION_REPO}/${PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR})
${PROJECT_SOURCE_DIR}/../${GIT_DOCUMENTATION_REPO}/${PROJECT_NAME}-${VERSION_MAJOR}.${VERSION_MINOR})
add_custom_target(doxycopy
COMMAND ${CMAKE_COMMAND} -E remove_directory ${GIT_DOCUMENTATION_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/doc/html ${GIT_DOCUMENTATION_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_BINARY_DIR}/doc/html ${GIT_DOCUMENTATION_DIR}
COMMENT "Copying API documentation to ${GIT_DOCUMENTATION_DIR}"
DEPENDS doxygen VERBATIM)

add_custom_target(doxygit
COMMAND ${CMAKE_COMMAND} -DCMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
-DCMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}"
COMMAND ${CMAKE_COMMAND} -DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
-DPROJECT_BINARY_DIR="${PROJECT_BINARY_DIR}"
-DPROJECT_NAME="${GIT_DOCUMENTATION_REPO}"
-DDOXYGIT_TOC_POST="${DOXYGIT_TOC_POST}"
-DDOXYGIT_MAX_VERSIONS="${DOXYGIT_MAX_VERSIONS}"
-P ${CMAKE_CURRENT_LIST_DIR}/Doxygit.cmake
COMMENT "Updating ${GIT_DOCUMENTATION_REPO}"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../${GIT_DOCUMENTATION_REPO}"
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/../${GIT_DOCUMENTATION_REPO}"
DEPENDS doxycopy)
else()
add_custom_target(doxygit
Expand Down
Loading

0 comments on commit 54b0389

Please sign in to comment.