dev-cafe / autocmake

CMake plugin composer.
http://autocmake.org
BSD 3-Clause "New" or "Revised" License
41 stars 18 forks source link

git_info in own subdirectory, documentation #218

Open miroi opened 6 years ago

miroi commented 6 years ago

Hi Rado,

git_info module is sitting in own subdirectory, according to autocmake test,

- git_info:
  - source: ../../../modules/git_info/git_info.cmake

and this is not mentioned in documentation: https://autocmake.readthedocs.io/en/latest/module-reference.html#git-info-cmake

miroi commented 6 years ago

Well, somehow I can not restore git_info.h generation in mathlibs_tester ....

miroi commented 6 years ago

such composed CMakeFiles... does not have target git_info ...

# project name
project(myproject Fortran C CXX)

# do not rebuild if rules (compiler flags) change
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)

# if CMAKE_BUILD_TYPE undefined, we set it to Release
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Release")
endif()

# directories which hold included cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/custom)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/downloaded)

# included cmake modules
include(autocmake_fc)
include(autocmake_cc)
include(autocmake_cxx)
include(autocmake_GNU.C)
include(autocmake_GNU.CXX)
include(autocmake_GNU.Fortran)
include(autocmake_Intel.C)
include(autocmake_Intel.CXX)
include(autocmake_Intel.Fortran)
include(autocmake_PGI.C)
include(autocmake_PGI.CXX)
include(autocmake_PGI.Fortran)
include(autocmake_XL.C)
include(autocmake_XL.CXX)
include(autocmake_XL.Fortran)
include(autocmake_definitions)
include(autocmake_python_interpreter)
include(autocmake_math_libs)
include(autocmake_code_coverage)
include(autocmake_profile)
include(autocmake_int64)
include(autocmake_safeguards)
include(autocmake_default_build_paths)
include(autocmake_git_info)
include(autocmake_version)
include(autocmake_src)
include(static_linking)
include(main_custom)
miroi commented 6 years ago

hmm, https://travis-ci.org/miroi/mathlibs-tester/builds/306400814#L758

miroi commented 6 years ago

strange ... although include(autocmake_git_info) is included, it behaves as it does not exist ...

miroi commented 6 years ago

Found the problem, one has to include generate_git_info_header(${PROJECT_BINARY_DIR} git_info.h).

Also documentation is fine, so closing this ticket.

bast commented 6 years ago

Good :-) Thanks for reporting. It can also mean that doc is not as clear as it could be. In this case please point me to the place which was confusingly or too sparsely formulated and we can see whether we can improve this.

miroi commented 6 years ago

Hi, please extend https://autocmake.readthedocs.io/en/latest/module-reference.html#git-info-cmake to mention the generate_git_info_header(${PROJECT_BINARY_DIR} git_info.h) macro. This has to be in user's custom cmake in order to generate the desired git_info.h file.

bast commented 6 years ago

OK reopening.

miroi commented 6 years ago

Well, to generalize this issue: if there are other cmake files defining some important macros, this has to be mentioned in the documentation. Otherwise use forgets to use the macro, like me.