From 54b038902fc3434bc6b3035232b0edd2cfb9e66d Mon Sep 17 00:00:00 2001 From: Stefan Eilemann Date: Tue, 12 Aug 2014 11:45:29 +0200 Subject: [PATCH] CR #186 --- BuildConfig.cmake | 2 +- Buildyard.cmake | 16 ++++++------ Common.cmake | 14 +++++------ CommonApplication.cmake | 2 +- CommonCPPCTest.cmake | 8 +++--- CommonCPack.cmake | 8 +++--- CommonCTest.cmake | 6 +++++ CommonCode.cmake | 20 +++++++-------- CommonLibrary.cmake | 11 ++++----- Coverage.cmake | 16 ++++++------ CppcheckTargets.cmake | 12 ++++++--- CpplintTargets.cmake | 2 +- DoxygenRule.cmake | 28 ++++++++++----------- Doxygit.cmake | 53 ++++++++++++++++++---------------------- FindDisplayCluster.cmake | 4 +-- FindFlowVR.cmake | 6 ++--- FindGLEW_MX.cmake | 6 ++--- FindNumPy.cmake | 4 +-- FindSAGE.cmake | 6 ++--- FindTuvok.cmake | 4 +-- FindVTune.cmake | 2 +- Findcapnproto.cmake | 8 +++--- Findcpplint.cmake | 4 +-- Findflatbuffers.cmake | 8 +++--- GNUModules.cmake | 8 +++--- GitExternal.cmake | 2 +- GitInfo.cmake | 12 ++++----- GitTargets.cmake | 30 +++++++++++------------ MacPorts.cmake | 10 ++++---- PackageConfig.cmake | 34 +++++++++++++------------- PackageInstall.cmake | 4 +-- ProjectInfo.cmake | 4 +-- SubProject.cmake | 2 +- UploadPPA.cmake | 4 +-- WriteModuleFile.cmake | 4 +-- 35 files changed, 184 insertions(+), 180 deletions(-) diff --git a/BuildConfig.cmake b/BuildConfig.cmake index c69d1ce..2b7f360 100644 --- a/BuildConfig.cmake +++ b/BuildConfig.cmake @@ -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) diff --git a/Buildyard.cmake b/Buildyard.cmake index 17b54e2..6af8a98 100644 --- a/Buildyard.cmake +++ b/Buildyard.cmake @@ -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() @@ -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() diff --git a/Common.cmake b/Common.cmake index 25d666b..2426e23 100644 --- a/Common.cmake +++ b/Common.cmake @@ -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() @@ -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) @@ -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) diff --git a/CommonApplication.cmake b/CommonApplication.cmake index baf725a..1b189d2 100644 --- a/CommonApplication.cmake +++ b/CommonApplication.cmake @@ -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}) diff --git a/CommonCPPCTest.cmake b/CommonCPPCTest.cmake index a494182..455431a 100644 --- a/CommonCPPCTest.cmake +++ b/CommonCPPCTest.cmake @@ -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() @@ -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) diff --git a/CommonCPack.cmake b/CommonCPack.cmake index e74b8ff..f74ce75 100644 --- a/CommonCPack.cmake +++ b/CommonCPack.cmake @@ -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) @@ -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") diff --git a/CommonCTest.cmake b/CommonCTest.cmake index 171581a..1f4338b 100644 --- a/CommonCTest.cmake +++ b/CommonCTest.cmake @@ -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 @@ -13,3 +18,4 @@ else() endif() set_target_properties(${PROJECT_NAME}_tests PROPERTIES FOLDER "Tests") +add_dependencies(tests ${PROJECT_NAME}_tests) diff --git a/CommonCode.cmake b/CommonCode.cmake index a78ba46..bf0a1f9 100644 --- a/CommonCode.cmake +++ b/CommonCode.cmake @@ -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() @@ -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) diff --git a/CommonLibrary.cmake b/CommonLibrary.cmake index d0225e3..9feb301 100644 --- a/CommonLibrary.cmake +++ b/CommonLibrary.cmake @@ -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} @@ -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( @@ -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() diff --git a/Coverage.cmake b/Coverage.cmake index f50626a..354b2c1 100644 --- a/Coverage.cmake +++ b/Coverage.cmake @@ -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) @@ -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() diff --git a/CppcheckTargets.cmake b/CppcheckTargets.cmake index 5ff9b06..9e56e08 100644 --- a/CppcheckTargets.cmake +++ b/CppcheckTargets.cmake @@ -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}) @@ -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) @@ -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}) @@ -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) diff --git a/CpplintTargets.cmake b/CpplintTargets.cmake index 9b849df..610cf32 100644 --- a/CpplintTargets.cmake +++ b/CpplintTargets.cmake @@ -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) diff --git a/DoxygenRule.cmake b/DoxygenRule.cmake index 3eac6d6..e980085 100644 --- a/DoxygenRule.cmake +++ b/DoxygenRule.cmake @@ -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 @@ -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) @@ -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) @@ -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 diff --git a/Doxygit.cmake b/Doxygit.cmake index 678ac42..385598b 100644 --- a/Doxygit.cmake +++ b/Doxygit.cmake @@ -7,13 +7,8 @@ # # Also used by 'doxygit' target from DoxygenRule.cmake - -# The next two lines are deprecated, remove when all doc projects use -# .gitexternals -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/oss) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/common) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/common/oss) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/common) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake/common/oss) find_package(Git REQUIRED) option(COMMON_INSTALL_DOCUMENTATION "Install documentation projects" OFF) @@ -21,30 +16,30 @@ option(COMMON_INSTALL_DOCUMENTATION "Install documentation projects" OFF) include(CommonProcess) include(Maturity) -# PROJECT_NAME = PROJECT_NAME with capitalized first letter +# Project_NAME = PROJECT_NAME with capitalized first letter string(SUBSTRING ${PROJECT_NAME} 0 1 FIRST_LETTER) string(TOUPPER ${FIRST_LETTER} FIRST_LETTER) -string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" PROJECT_NAME +string(REGEX REPLACE "^.(.*)" "${FIRST_LETTER}\\1" Project_NAME "${PROJECT_NAME}") configure_file("${CMAKE_CURRENT_LIST_DIR}/github.css" - "${CMAKE_CURRENT_SOURCE_DIR}/CMake/github.css" COPYONLY) + "${PROJECT_SOURCE_DIR}/CMake/github.css" COPYONLY) common_process("Copy icons to documentation repository" FATAL_ERROR COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/icons - ${CMAKE_CURRENT_SOURCE_DIR}/images) + ${PROJECT_SOURCE_DIR}/images) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/index.html" +file(WRITE "${PROJECT_BINARY_DIR}/index.html" "\n" "\n" " \n" -" ${PROJECT_NAME} Software Directory\n" +" ${Project_NAME} Software Directory\n" " " " \n" " \n" "
" "

Projects

") -file(GLOB Entries RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *-*) +file(GLOB Entries RELATIVE ${PROJECT_SOURCE_DIR} *-*) if(NOT DOXYGIT_MAX_VERSIONS) set(DOXYGIT_MAX_VERSIONS 10) endif() @@ -70,7 +65,7 @@ foreach(Entry ${Entries}) foreach(SubEntry ${SubEntries}) # remove old documentation common_process("Remove old ${SubEntry}" FATAL_ERROR COMMAND ${CMAKE_COMMAND} -E remove_directory ${SubEntry} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) endforeach() set(LAST_Project ${Project}) @@ -95,14 +90,14 @@ macro(DOXYGIT_WRITE_ENTRY)

${${PROJECT}_DESCRIPTION}

") # start entry - file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/index.html" + file(APPEND "${PROJECT_BINARY_DIR}/index.html" "${Project} ${VERSION}
") set(BODY "${BODY} ") if(${PROJECT}_GIT_ROOT_URL) - file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/index.html" + file(APPEND "${PROJECT_BINARY_DIR}/index.html" "\"Source") set(BODY "${BODY}") endif() @@ -112,7 +107,7 @@ macro(DOXYGIT_WRITE_ENTRY) endif() if(${PROJECT}_PACKAGE_URL) - file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/index.html" + file(APPEND "${PROJECT_BINARY_DIR}/index.html" "\"Packages\"") set(BODY "${BODY}") endif() @@ -121,11 +116,11 @@ macro(DOXYGIT_WRITE_ENTRY) set(BODY "${BODY}") endif() - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${Entry}/CoverageReport/index.html") + if(EXISTS "${PROJECT_SOURCE_DIR}/${Entry}/CoverageReport/index.html") set(BODY "${BODY}") endif() - file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/index.html" + file(APPEND "${PROJECT_BINARY_DIR}/index.html" " \"${MATURITY_LONG}\"
") @@ -140,8 +135,8 @@ foreach(Entry ${Entries}) string(TOUPPER ${Entry} ENTRY) string(TOUPPER ${Project} PROJECT) set(${PROJECT}_MATURITY "EP") - if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${Entry}/ProjectInfo.cmake) - include(${CMAKE_CURRENT_SOURCE_DIR}/${Entry}/ProjectInfo.cmake) + if(EXISTS ${PROJECT_SOURCE_DIR}/${Entry}/ProjectInfo.cmake) + include(${PROJECT_SOURCE_DIR}/${Entry}/ProjectInfo.cmake) endif() set(MATURITY ${${PROJECT}_MATURITY}) set(MATURITY_LONG ${MATURITY_${MATURITY}}) @@ -161,26 +156,26 @@ foreach(Entry ${Entries}) list(APPEND GIT_DOCUMENTATION_INSTALL ${Entry}) endforeach() -file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/index.html" "${DOXYGIT_TOC_POST} +file(APPEND "${PROJECT_BINARY_DIR}/index.html" "${DOXYGIT_TOC_POST}
-

${PROJECT_NAME} Software Directory

+

${Project_NAME} Software Directory

${BODY}
") -configure_file("${CMAKE_CURRENT_BINARY_DIR}/index.html" - "${CMAKE_CURRENT_SOURCE_DIR}/index.html" COPYONLY) +configure_file("${PROJECT_BINARY_DIR}/index.html" + "${PROJECT_SOURCE_DIR}/index.html" COPYONLY) execute_process(COMMAND "${GIT_EXECUTABLE}" add --all images ${Entries} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}") + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}") if(COMMON_INSTALL_DOCUMENTATION) foreach(FOLDER ${GIT_DOCUMENTATION_INSTALL}) - install(DIRECTORY ${FOLDER} DESTINATION share/${PROJECT_NAME} + install(DIRECTORY ${FOLDER} DESTINATION share/${Project_NAME} CONFIGURATIONS Release) endforeach() endif() # need at least one file for 'make install' -install(FILES index.html DESTINATION share/${PROJECT_NAME} +install(FILES index.html DESTINATION share/${Project_NAME} CONFIGURATIONS Release) diff --git a/FindDisplayCluster.cmake b/FindDisplayCluster.cmake index d10e146..9b9e89b 100644 --- a/FindDisplayCluster.cmake +++ b/FindDisplayCluster.cmake @@ -25,7 +25,7 @@ else() endif() find_path(_DISPLAYCLUSTER_INCLUDE_DIR dc/Stream.h - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{DISPLAYCLUSTER_ROOT} ${DISPLAYCLUSTER_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{DISPLAYCLUSTER_ROOT} ${DISPLAYCLUSTER_ROOT} PATH_SUFFIXES include PATHS /usr /usr/local /opt /opt/local) @@ -65,7 +65,7 @@ if(DISPLAYCLUSTER_FIND_VERSION AND DISPLAYCLUSTER_VERSION) endif() find_library(DISPLAYCLUSTER_LIBRARY dcstream - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{DISPLAYCLUSTER_ROOT} ${DISPLAYCLUSTER_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{DISPLAYCLUSTER_ROOT} ${DISPLAYCLUSTER_ROOT} PATH_SUFFIXES lib lib64 PATHS /usr /usr/local /opt /opt/local) diff --git a/FindFlowVR.cmake b/FindFlowVR.cmake index 8c51cf1..92a8655 100644 --- a/FindFlowVR.cmake +++ b/FindFlowVR.cmake @@ -28,7 +28,7 @@ set(FLOWVR_INCLUDE_DIRS) find_path(FLOWVRVR_BASE_INCLUDE_DIR flowvr/buffer.h PATH_SUFFIXES include - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/include /usr /opt ) + PATHS ${PROJECT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/include /usr /opt ) if(FLOWVRVR_BASE_INCLUDE_DIR) list(APPEND FLOWVR_INCLUDE_DIRS ${FLOWVRVR_BASE_INCLUDE_DIR}) @@ -36,7 +36,7 @@ endif() find_path(FLOWVRVR_MODULE_INCLUDE_DIR flowvr/module.h PATH_SUFFIXES include - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/include /usr /opt ) + PATHS ${PROJECT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/include /usr /opt ) if(FLOWVRVR_MODULE_INCLUDE_DIR) list(APPEND FLOWVR_INCLUDE_DIRS ${FLOWVRVR_MODULE_INCLUDE_DIR}) @@ -63,7 +63,7 @@ set(FLOWVR_LIBRARIES) foreach(FLOWVR_LIBRARY ${_FLOWVR_LIBRARIES}) find_library(${FLOWVR_LIBRARY}_LIBRARY ${FLOWVR_LIBRARY} PATH_SUFFIXES lib lib64 - PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/local /usr /usr/local /opt /opt/local ) + PATHS ${PROJECT_SOURCE_DIR}/../../.. $ENV{FLOWVR_PREFIX} /usr/local /usr /usr/local /opt /opt/local ) if(${FLOWVR_LIBRARY}_LIBRARY) list(APPEND FLOWVR_LIBRARIES ${${FLOWVR_LIBRARY}_LIBRARY}) if(NOT _FlowVR_quiet) diff --git a/FindGLEW_MX.cmake b/FindGLEW_MX.cmake index 1ee8eae..c830d11 100644 --- a/FindGLEW_MX.cmake +++ b/FindGLEW_MX.cmake @@ -15,7 +15,7 @@ find_library(_glew_mx_LIBRARY PATHS /usr/lib /usr/local/lib) if(_glew_mx_INCLUDE_DIR AND _glew_mx_LIBRARY) - set(TEST_SRC ${CMAKE_CURRENT_BINARY_DIR}/glew_test.cpp) + set(TEST_SRC ${PROJECT_BINARY_DIR}/glew_test.cpp) file(WRITE ${TEST_SRC} "#include \n" "int main( )\n" @@ -24,7 +24,7 @@ if(_glew_mx_INCLUDE_DIR AND _glew_mx_LIBRARY) "}\n" ) - try_compile(_glew_mx_SUPPORTED ${CMAKE_CURRENT_BINARY_DIR}/glew_test ${TEST_SRC} + try_compile(_glew_mx_SUPPORTED ${PROJECT_BINARY_DIR}/glew_test ${TEST_SRC} CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_glew_mx_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${_glew_mx_LIBRARY}" @@ -46,7 +46,7 @@ if(_glew_mx_INCLUDE_DIR AND _glew_mx_LIBRARY) "}\n" ) - try_compile(_glxew_mx_SUPPORTED ${CMAKE_CURRENT_BINARY_DIR}/glew_test ${TEST_SRC} + try_compile(_glxew_mx_SUPPORTED ${PROJECT_BINARY_DIR}/glew_test ${TEST_SRC} CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${_glew_mx_INCLUDE_DIR}" "-DLINK_LIBRARIES:STRING=${_glew_mx_LIBRARY}" diff --git a/FindNumPy.cmake b/FindNumPy.cmake index 5e62b0c..63a5440 100644 --- a/FindNumPy.cmake +++ b/FindNumPy.cmake @@ -14,11 +14,11 @@ endif() if (PYTHON_EXECUTABLE) # write a python script that finds the numpy path - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/FindNumpyPath.py + file(WRITE ${PROJECT_BINARY_DIR}/FindNumpyPath.py "try: import numpy; print numpy.get_include()\nexcept:pass\n") # execute the find script - exec_program("${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_BINARY_DIR} + exec_program("${PYTHON_EXECUTABLE}" ${PROJECT_BINARY_DIR} ARGS "FindNumpyPath.py" OUTPUT_VARIABLE NUMPY_PATH) elseif(_numpy_out) diff --git a/FindSAGE.cmake b/FindSAGE.cmake index 1a960b2..78e6254 100644 --- a/FindSAGE.cmake +++ b/FindSAGE.cmake @@ -28,7 +28,7 @@ if(SAGE_FIND_QUIETLY) endif() find_path(_SAGE_INCLUDE_DIR sage.h - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} PATH_SUFFIXES include sage/include PATHS /usr/local/sage /usr /usr/local /opt /opt/local) @@ -63,12 +63,12 @@ if(SAGE_FIND_VERSION AND SAGE_VERSION) endif() find_library(SAGE_SAIL_LIBRARY sail - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} PATH_SUFFIXES lib lib64 sage/lib sage/lib64 PATHS /usr/local/sage /usr /usr/local /opt /opt/local) find_library(SAGE_QUANTA_LIBRARY quanta - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{SAGE_ROOT} ${SAGE_ROOT} PATH_SUFFIXES lib lib64 sage/lib sage/lib64 PATHS /usr/local/sage /usr /usr/local /opt /opt/local) diff --git a/FindTuvok.cmake b/FindTuvok.cmake index 93dc601..aed8779 100644 --- a/FindTuvok.cmake +++ b/FindTuvok.cmake @@ -27,7 +27,7 @@ if(TUVOK_FIND_QUIETLY) endif() find_path(_TUVOK_INCLUDE_DIR StdTuvokDefines.h - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{TUVOK_ROOT} ${TUVOK_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{TUVOK_ROOT} ${TUVOK_ROOT} PATH_SUFFIXES include/Tuvok PATHS /usr/local /usr /opt ) @@ -41,7 +41,7 @@ else() endif() find_library(TUVOK_LIBRARY Tuvok - HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../../.. $ENV{TUVOK_ROOT} ${TUVOK_ROOT} + HINTS ${PROJECT_SOURCE_DIR}/../../.. $ENV{TUVOK_ROOT} ${TUVOK_ROOT} PATH_SUFFIXES lib lib64 PATHS /usr/local /usr /usr/local /opt /opt/local) diff --git a/FindVTune.cmake b/FindVTune.cmake index e28cd42..5265e79 100644 --- a/FindVTune.cmake +++ b/FindVTune.cmake @@ -19,7 +19,7 @@ find_program(VTUNE_EXECUTABLE amplxe-cl) if(NOT VTUNE_EXECUTABLE) set(VTUNE_FOUND) configure_file(${CMAKE_CURRENT_LIST_DIR}/ittnotify.h - ${CMAKE_CURRENT_BINARY_DIR}/include/ittnotify.h COPYONLY) + ${PROJECT_BINARY_DIR}/include/ittnotify.h COPYONLY) add_definitions(-DINTEL_NO_ITTNOTIFY_API) return() endif() diff --git a/Findcapnproto.cmake b/Findcapnproto.cmake index 75368b2..56ffe53 100644 --- a/Findcapnproto.cmake +++ b/Findcapnproto.cmake @@ -25,21 +25,21 @@ if(CAPNPROTO_FOUND) foreach(FILE ${ARGN}) get_filename_component(CAPNP_OUTPUT ${FILE} NAME_WE) set(CAPNP_OUTPUT - "${CMAKE_CURRENT_BINARY_DIR}/${CAPNP_OUTPUT}_generated.h") + "${PROJECT_BINARY_DIR}/${CAPNP_OUTPUT}_generated.h") list(APPEND CAPNP_OUTPUTS ${CAPNP_OUTPUT}) add_custom_command(OUTPUT ${CAPNP_OUTPUT} COMMAND PATH=${CAPNP_DIR} ${CAPNP_EXECUTABLE} - ARGS compile -oc++:"${CMAKE_CURRENT_BINARY_DIR}/" ${FILE} + ARGS compile -oc++:"${PROJECT_BINARY_DIR}/" ${FILE} COMMENT "Building C++ header for ${FILE}" DEPENDS ${FILE} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) endforeach() set(${Name}_OUTPUTS ${CAPNP_OUTPUTS} PARENT_SCOPE) endfunction() set(CAPNPROTO_INCLUDE_DIRS ${CAPNPROTO_INCLUDE_DIR}) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${PROJECT_BINARY_DIR}) else() set(CAPNPROTO_INCLUDE_DIR) endif() diff --git a/Findcpplint.cmake b/Findcpplint.cmake index 03bd37a..4210174 100644 --- a/Findcpplint.cmake +++ b/Findcpplint.cmake @@ -50,8 +50,8 @@ if(CPPLINT_ROOT_DIR) endif(CPPLINT_ROOT_DIR) set(CPPLINT_SCRIPT_DEFAULT_LOCATIONS - "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/util" "${CMAKE_CURRENT_SOURCE_DIR}/scripts" - "${CMAKE_CURRENT_SOURCE_DIR}/util/scripts" "${CMAKE_CURRENT_LIST_DIR}/util") + "${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/util" "${PROJECT_SOURCE_DIR}/scripts" + "${PROJECT_SOURCE_DIR}/util/scripts" "${CMAKE_CURRENT_LIST_DIR}/util") find_file(CPPLINT_SCRIPT NAMES cpplint.py diff --git a/Findflatbuffers.cmake b/Findflatbuffers.cmake index 274fc40..eea0976 100644 --- a/Findflatbuffers.cmake +++ b/Findflatbuffers.cmake @@ -21,21 +21,21 @@ if(FLATBUFFERS_FOUND) foreach(FILE ${ARGN}) get_filename_component(FLATC_OUTPUT ${FILE} NAME_WE) set(FLATC_OUTPUT - "${CMAKE_CURRENT_BINARY_DIR}/${FLATC_OUTPUT}_generated.h") + "${PROJECT_BINARY_DIR}/${FLATC_OUTPUT}_generated.h") list(APPEND FLATC_OUTPUTS ${FLATC_OUTPUT}) add_custom_command(OUTPUT ${FLATC_OUTPUT} COMMAND ${FLATC_EXECUTABLE} - ARGS -c -o "${CMAKE_CURRENT_BINARY_DIR}/" ${FILE} + ARGS -c -o "${PROJECT_BINARY_DIR}/" ${FILE} COMMENT "Building C++ header for ${FILE}" DEPENDS ${FILE} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) endforeach() set(${Name}_OUTPUTS ${FLATC_OUTPUTS} PARENT_SCOPE) endfunction() set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIR}) - include_directories(${CMAKE_CURRENT_BINARY_DIR}) + include_directories(${PROJECT_BINARY_DIR}) else() set(FLATBUFFERS_INCLUDE_DIR) endif() diff --git a/GNUModules.cmake b/GNUModules.cmake index 4d7d50a..2bb1513 100644 --- a/GNUModules.cmake +++ b/GNUModules.cmake @@ -136,7 +136,7 @@ set(MODULE_SRC_INSTALL "${MODULE_SW_BASEDIR}/${MODULE_SW_CLASS}/${MODULE_PACKAGE get_property(INSTALL_DEPENDS GLOBAL PROPERTY ${PROJECT_NAME}_ALL_DEP_TARGETS) add_custom_target(module_install - COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${MODULE_SRC_INSTALL} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_install.cmake + COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${MODULE_SRC_INSTALL} -P ${PROJECT_BINARY_DIR}/cmake_install.cmake COMMENT "Installing GNU module source at ${MODULE_SRC_INSTALL}" VERBATIM DEPENDS ${${PROJECT_NAME}_ALL_DEP_TARGETS}) @@ -146,12 +146,12 @@ add_custom_target(module -DMODULE_FILENAME=${MODULE_FILENAME} -P WriteModuleFile.cmake COMMAND ${CMAKE_COMMAND} -E copy ${MODULE_FILENAME} ${MODULE_MODULEFILES}/${MODULE_FILENAME} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Creating GNU module ${MODULE_FILENAME} at ${MODULE_MODULEFILES}" VERBATIM DEPENDS module_install) # 'return value' for metamodule -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/Module.txt "${MODULE_FILENAME}") +file(WRITE ${PROJECT_BINARY_DIR}/Module.txt "${MODULE_FILENAME}") # Snapshot module ################################################################################ @@ -180,6 +180,6 @@ add_custom_target(snapshot COMMAND ${CMAKE_COMMAND} -DMODULE_PACKAGE_NAME=${MODULE_PACKAGE_NAME} -DMODULE_VERSION=${MODULE_VERSION} -DMODULE_FILENAME=${MODULE_FILENAME} -DMODULE_MESSAGE_AFTER_LOAD=${MODULE_MESSAGE_AFTER_LOAD} -P WriteModuleFile.cmake COMMAND ${CMAKE_COMMAND} -E copy ${MODULE_FILENAME} ${MODULE_MODULEFILES}/${MODULE_FILENAME} COMMAND ${CMAKE_COMMAND} -E create_symlink ${MODULE_MODULEFILES}/${MODULE_FILENAME} ${MODULE_MODULEFILES}/${MODULE_PACKAGE_NAME}/latest - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ${PROJECT_BINARY_DIR} COMMENT "Creating snapshot module ${MODULE_FILENAME} at ${MODULE_MODULEFILES}" VERBATIM DEPENDS snapshot_install) diff --git a/GitExternal.cmake b/GitExternal.cmake index fc8fa9a..0b77643 100644 --- a/GitExternal.cmake +++ b/GitExternal.cmake @@ -52,7 +52,7 @@ function(GIT_EXTERNAL DIR REPO TAG) if(IS_DIRECTORY "${DIR}/.git") if (${GIT_EXTERNAL_NO_UPDATE}) - GIT_EXTERNAL_MESSAGE("Update branch disabled by user") + GIT_EXTERNAL_MESSAGE("git update disabled by user") else() GIT_EXTERNAL_MESSAGE("current ref is \"${currentref}\" and tag is \"${TAG}\"") if(currentref STREQUAL TAG) # nothing to do diff --git a/GitInfo.cmake b/GitInfo.cmake index 45a3dd6..886d909 100644 --- a/GitInfo.cmake +++ b/GitInfo.cmake @@ -20,24 +20,24 @@ set(GIT_ORIGIN_URL) set(GIT_ROOT_URL) set(GIT_BRANCH) -if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) +if(EXISTS ${PROJECT_SOURCE_DIR}/.git) find_package(Git) if(GIT_FOUND) execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_REVISION OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process( COMMAND ${GIT_EXECUTABLE} describe --long --tags --dirty - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} OUTPUT_VARIABLE GIT_STATE OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) execute_process( COMMAND ${GIT_EXECUTABLE} config --get remote.origin.url OUTPUT_VARIABLE GIT_ORIGIN_URL OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) execute_process( COMMAND ${GIT_EXECUTABLE} config --get remote.root.url OUTPUT_VARIABLE GIT_ROOT_URL OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) execute_process( COMMAND ${GIT_EXECUTABLE} branch --contains HEAD OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) if(NOT GIT_REVISION) set(GIT_REVISION "0") diff --git a/GitTargets.cmake b/GitTargets.cmake index e64046f..fdbc519 100644 --- a/GitTargets.cmake +++ b/GitTargets.cmake @@ -48,7 +48,7 @@ endif() add_custom_target(make-branch_${PROJECT_NAME} COMMAND ${GIT_EXECUTABLE} checkout -b ${BRANCH_VERSION} COMMENT "Create local branch ${BRANCH_VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" ) if(TARGET flatten_git_external) @@ -60,7 +60,7 @@ endif() add_custom_target(branch_${PROJECT_NAME} COMMAND ${GIT_EXECUTABLE} push origin ${BRANCH_VERSION} COMMENT "Add remote branch ${BRANCH_VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" DEPENDS ${BRANCH_DEP} ) @@ -69,21 +69,21 @@ add_custom_target(cut_${PROJECT_NAME} COMMAND ${GIT_EXECUTABLE} branch -d ${BRANCH_VERSION} COMMAND ${GIT_EXECUTABLE} push origin --delete ${BRANCH_VERSION} COMMENT "Remove branch ${BRANCH_VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" ) # tag on branch -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gitbranchandtag.cmake +file(WRITE ${PROJECT_BINARY_DIR}/gitbranchandtag.cmake "# Branch: if(\"${GITTARGETS_RELEASE_BRANCH}\" STREQUAL current) set(TAG_BRANCH) else() execute_process(COMMAND ${GIT_EXECUTABLE} branch ${BRANCH_VERSION} RESULT_VARIABLE hadbranch ERROR_VARIABLE error - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) if(NOT hadbranch) execute_process(COMMAND ${GIT_EXECUTABLE} push origin ${BRANCH_VERSION} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) endif() set(TAG_BRANCH ${BRANCH_VERSION}) endif() @@ -92,16 +92,16 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gitbranchandtag.cmake execute_process( COMMAND ${GIT_EXECUTABLE} tag -f ${VERSION} ${TAG_BRANCH} COMMAND ${GIT_EXECUTABLE} push --tags - RESULT_VARIABLE notdone WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + RESULT_VARIABLE notdone WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) if(notdone) message(FATAL_ERROR \"Error creating tag ${VERSION} on branch ${TAG_BRANCH}\") endif()") add_custom_target(tag_${PROJECT_NAME} - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/gitbranchandtag.cmake + COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/gitbranchandtag.cmake COMMENT "Add tag ${VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" ) # remove tag @@ -109,24 +109,24 @@ add_custom_target(erase_${PROJECT_NAME} COMMAND ${GIT_EXECUTABLE} tag -d ${VERSION} COMMAND ${GIT_EXECUTABLE} push origin :${VERSION} COMMENT "Remove tag ${VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" ) # move tag add_custom_target(retag_${PROJECT_NAME} - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/gitbranchandtag.cmake + COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/gitbranchandtag.cmake COMMENT "Add tag ${VERSION}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" DEPENDS erase_${PROJECT_NAME}) # tarball -set(TARBALL "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-${LAST_RELEASE}.tar") +set(TARBALL "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-${LAST_RELEASE}.tar") add_custom_target(tarball-create_${PROJECT_NAME} COMMAND ${GIT_EXECUTABLE} archive --worktree-attributes --prefix ${PROJECT_NAME}-${LAST_RELEASE}/ -o ${TARBALL} ${LAST_RELEASE} - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" COMMENT "Creating ${TARBALL}" ) @@ -135,7 +135,7 @@ if(GZIP_EXECUTABLE) COMMAND ${CMAKE_COMMAND} -E remove ${TARBALL}.gz COMMAND ${GZIP_EXECUTABLE} ${TARBALL} DEPENDS tarball-create_${PROJECT_NAME} - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}" COMMENT "Compressing ${TARBALL}.gz" ) set(TARBALL_GZ "${TARBALL}.gz") diff --git a/MacPorts.cmake b/MacPorts.cmake index bdb56eb..95f8b27 100644 --- a/MacPorts.cmake +++ b/MacPorts.cmake @@ -37,8 +37,8 @@ set(CPACK_MACPORTS_DEPENDS "${CPACK_MACPORTS_TEMP}") # Create and install Portfile set(PORTFILE_DIR "ports/${CPACK_MACPORTS_CATEGORY}/${CMAKE_MACPORTS_NAME}") -set(PORTFILE_GH_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../${MACPORTS_DIR}") -set(PORTFILE "${CMAKE_CURRENT_BINARY_DIR}/${PORTFILE_DIR}/Portfile") +set(PORTFILE_GH_DIR "${PROJECT_SOURCE_DIR}/../${MACPORTS_DIR}") +set(PORTFILE "${PROJECT_BINARY_DIR}/${PORTFILE_DIR}/Portfile") set(PORTFILE_GH "${PORTFILE_GH_DIR}/${PORTFILE_DIR}/Portfile") configure_file(${CMAKE_CURRENT_LIST_DIR}/Portfile ${PORTFILE} @ONLY) @@ -47,12 +47,12 @@ install(CODE "execute_process(COMMAND /opt/local/bin/portindex ${CMAKE_INSTALL_PREFIX}/ports)" COMPONENT lib) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/MacPortfile.cmake - "list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake)\n" +file(WRITE ${PROJECT_BINARY_DIR}/MacPortfile.cmake + "list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMake)\n" "configure_file(${PORTFILE} ${PORTFILE_GH} COPYONLY)\n" "execute_process(COMMAND /opt/local/bin/portindex ${PORTFILE_GH_DIR}/ports)" ) add_custom_target(portfile_${PROJECT_NAME} - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/MacPortfile.cmake + COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/MacPortfile.cmake COMMENT "Updating ${MACPORTS_DIR}") diff --git a/PackageConfig.cmake b/PackageConfig.cmake index 968dfdf..28a0859 100644 --- a/PackageConfig.cmake +++ b/PackageConfig.cmake @@ -216,7 +216,7 @@ set(_config_file_final "endif()\n" ) -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.in +file(WRITE ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.in ${_config_file_prefix} ${_config_file_body} ${_config_file_standard_find} @@ -225,9 +225,9 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.in # write a project config which will be used to find packages in the build directory # when projects are compiled as subprojects of another larger project -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.build.in - "set(${PROJECT_NAME}_PREFIX_DIR ${CMAKE_CURRENT_BINARY_DIR})\n" - "set(${UPPER_PROJECT_NAME}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})\n" +file(WRITE ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.build.in + "set(${PROJECT_NAME}_PREFIX_DIR ${PROJECT_BINARY_DIR})\n" + "set(${UPPER_PROJECT_NAME}_INCLUDE_DIRS ${PROJECT_SOURCE_DIR})\n" "\n" ${_config_file_body} ${_config_file_subproject_find} @@ -321,31 +321,31 @@ if(LIBRARY_NAMES) endif() configure_package_config_file( - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.in + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION ${CMAKE_MODULE_INSTALL_PATH} PATH_VARS INCLUDE_INSTALL_DIR ${HAS_LIBRARY_NAMES} DEPENDENTS NO_CHECK_REQUIRED_COMPONENTS_MACRO) configure_file( - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.build.in - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake.build.in + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY ) # create and install ProjectConfigVersion.cmake write_basic_package_version_file( - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake VERSION ${VERSION_MAJOR}.${VERSION_MINOR} COMPATIBILITY SameMajorVersion) install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake + FILES ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}Config.cmake + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake DESTINATION ${CMAKE_MODULE_INSTALL_PATH} COMPONENT dev) configure_file( - ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake + ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}ConfigVersion.cmake + ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake COPYONLY ) @@ -355,7 +355,7 @@ if(NOT LIBRARY_DIR) set(LIBRARY_DIR lib) endif() -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc +file(WRITE ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc "prefix=${CMAKE_INSTALL_PREFIX}\n" "exec_prefix=\${prefix}\n" "libdir=\${exec_prefix}/${LIBRARY_DIR}\n" @@ -368,10 +368,10 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc "Cflags: -I\${includedir}\n" "Libs: -L\${libdir}" ) foreach(_library ${LIBRARY_NAMES}) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc + file(APPEND ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc " -l${_library}") endforeach() -file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc "\n") +file(APPEND ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc "\n") -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc +install(FILES ${PROJECT_BINARY_DIR}/pkg/${PROJECT_NAME}.pc DESTINATION ${LIBRARY_DIR}/pkgconfig COMPONENT dev) diff --git a/PackageInstall.cmake b/PackageInstall.cmake index baa20cb..67b49dc 100644 --- a/PackageInstall.cmake +++ b/PackageInstall.cmake @@ -10,11 +10,11 @@ if(NOT TARGET package-install AND PACKAGE_FILE_NAME) else() message(STATUS "Unknown system installer, using 'make install'") set(SYSTEM_INSTALL_CMD - ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR} --target install) + ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target install) endif() add_custom_target(package-install - COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR} --target package + COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target package COMMAND sudo ${SYSTEM_INSTALL_CMD} ${PACKAGE_FILE_NAME} COMMENT "Build and sudo install package" VERBATIM) diff --git a/ProjectInfo.cmake b/ProjectInfo.cmake index 7cfba37..ce1af71 100644 --- a/ProjectInfo.cmake +++ b/ProjectInfo.cmake @@ -19,8 +19,8 @@ if(DPUT_HOST AND NOT ${UPPER_PROJECT_NAME}_PACKAGE_URL) endif() configure_file(${CMAKE_CURRENT_LIST_DIR}/ProjectInfo.in.cmake - ${CMAKE_CURRENT_BINARY_DIR}/ProjectInfo.cmake) + ${PROJECT_BINARY_DIR}/ProjectInfo.cmake) add_custom_target(project_info_${PROJECT_NAME} ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/ProjectInfo.cmake ${CMAKE_CURRENT_BINARY_DIR}/doc/html) + ${PROJECT_BINARY_DIR}/ProjectInfo.cmake ${PROJECT_BINARY_DIR}/doc/html) diff --git a/SubProject.cmake b/SubProject.cmake index 930e5b0..ba803a6 100644 --- a/SubProject.cmake +++ b/SubProject.cmake @@ -10,7 +10,7 @@ MACRO(ADD_SUBPROJECT name path) IF(SUBPROJECT_${name}) # if the project needs to do anything special when configured as a sub project # then it should check the variable ${PROJECT_NAME}_EXTERNALLY_CONFIGURED - set(${name}_EXTERNALLY_CONFIGURED 1) + set(${name}_EXTERNALLY_CONFIGURED ON) # set ${PROJECT}_DIR to the location of the new build dir for the project if (NOT ${name}_DIR) diff --git a/UploadPPA.cmake b/UploadPPA.cmake index a28a083..6887440 100644 --- a/UploadPPA.cmake +++ b/UploadPPA.cmake @@ -55,7 +55,7 @@ foreach(LINE ${DESC_LINES}) endforeach(LINE ${DESC_LINES}) function(UPLOAD_PPA UBUNTU_NAME) - set(DEBIAN_BASE_DIR ${CMAKE_CURRENT_BINARY_DIR}/Debian/${UBUNTU_NAME}) + set(DEBIAN_BASE_DIR ${PROJECT_BINARY_DIR}/Debian/${UBUNTU_NAME}) file(REMOVE_RECURSE ${DEBIAN_BASE_DIR}) set(DEBIAN_SOURCE_DIR ${DEBIAN_BASE_DIR}/${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-source) @@ -64,7 +64,7 @@ function(UPLOAD_PPA UBUNTU_NAME) COMMAND ${GIT_EXECUTABLE} archive --worktree-attributes --prefix ${CPACK_DEBIAN_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-source/ -o ${DEBIAN_BASE_DIR}.tar HEAD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEBIAN_BASE_DIR}.tar WORKING_DIRECTORY ${DEBIAN_BASE_DIR}) diff --git a/WriteModuleFile.cmake b/WriteModuleFile.cmake index 0c58d38..a9e0240 100644 --- a/WriteModuleFile.cmake +++ b/WriteModuleFile.cmake @@ -9,14 +9,14 @@ # - MODULE_MESSAGE_AFTER_LOAD: A message to be displayed after the module was loaded -file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/WriteModuleFile.cmake +file(WRITE ${PROJECT_BINARY_DIR}/WriteModuleFile.cmake "\n" "if(NOT MODULE_FILENAME OR NOT MODULE_PACKAGE_NAME OR NOT MODULE_VERSION)\n" " message(FATAL_ERROR \"Need MODULE_FILENAME, MODULE_PACKAGE_NAME and MODULE_VERSION for module file generation\")\n" "endif()\n" # write file - "file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/\${MODULE_FILENAME}\n" + "file(WRITE ${PROJECT_BINARY_DIR}/\${MODULE_FILENAME}\n" " \"#%Module1.0\\n\"\n" " \"######################################################################\\n\"\n" " \"#\\n\"\n"