Fine-tune and fix tests
This commit is contained in:
		| @@ -9,12 +9,20 @@ | |||||||
| # | # | ||||||
| #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | #   url_root: https://github.com/coderefinery/autocmake/raw/master/ | ||||||
| #   fetch: | #   fetch: | ||||||
| #     - "%(url_root)modules/git_info/git_info_sub.cmake" |  | ||||||
| #     - "%(url_root)modules/git_info/git_info.h.in" | #     - "%(url_root)modules/git_info/git_info.h.in" | ||||||
|  |  | ||||||
|  | function(generate_git_info_header) | ||||||
|   # _header_location: where the Git info header file should be generated |   # _header_location: where the Git info header file should be generated | ||||||
|   # _header_name: the Git info header name, complete with extension (.h, .hpp, .hxx or whatever) |   # _header_name: the Git info header name, complete with extension (.h, .hpp, .hxx or whatever) | ||||||
| function(generate_git_info_header _header_location _header_name) |   if(${ARGC} EQUAL 2) | ||||||
|  |     set(_header_location ${ARGV0}) | ||||||
|  |     set(_header_name     ${ARGV1}) | ||||||
|  |   elseif(${ARGC} EQUAL 0) | ||||||
|  |     set(_header_location ${PROJECT_BINARY_DIR}) | ||||||
|  |     set(_header_name git_info.h) | ||||||
|  |   else() | ||||||
|  |     message(FATAL_ERROR "generate_git_info_header function accepts either two or no arguments") | ||||||
|  |   endif() | ||||||
|   find_package(Git) |   find_package(Git) | ||||||
|  |  | ||||||
|   set(_git_last_commit_hash "unknown") |   set(_git_last_commit_hash "unknown") | ||||||
| @@ -65,6 +73,6 @@ function(generate_git_info_header _header_location _header_name) | |||||||
|  |  | ||||||
|   add_custom_target( |   add_custom_target( | ||||||
|     git_info |     git_info | ||||||
|     ALL DEPENDS ${PROJECT_BINARY_DIR}/git_info.h |     ALL DEPENDS ${_header_location}/${_header_name} | ||||||
|     ) |     ) | ||||||
| endfunction() | endfunction() | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ modules: | |||||||
|   - source: ../../../modules/fc.cmake |   - source: ../../../modules/fc.cmake | ||||||
| - default_build_paths: | - default_build_paths: | ||||||
|   - source: ../../../modules/default_build_paths.cmake |   - source: ../../../modules/default_build_paths.cmake | ||||||
| - src: |  | ||||||
|   - source: ../../../modules/src.cmake |  | ||||||
| - git_info: | - git_info: | ||||||
|   - source: ../../../modules/git_info/git_info.cmake |   - source: ../../../modules/git_info/git_info.cmake | ||||||
|  | - src: | ||||||
|  |   - source: ../../../modules/src.cmake | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | generate_git_info_header() | ||||||
| include_directories(${PROJECT_BINARY_DIR}) | include_directories(${PROJECT_BINARY_DIR}) | ||||||
|  |  | ||||||
| add_executable(example example.F90) | add_executable(example example.F90) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user