mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Move CMake variables printing into a utility macro
Added cmake_variables_helper.cmake providing 2 helpers - print_variable - print_all_variables Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
This commit is contained in:
parent
c2997c33c7
commit
7b08f8d23c
3 changed files with 49 additions and 6 deletions
|
@ -112,6 +112,7 @@ endif()
|
||||||
include(cmake/Modules/HandleFtdiSupport.cmake)
|
include(cmake/Modules/HandleFtdiSupport.cmake)
|
||||||
include(cmake/Modules/HandleVersionGeneration.cmake)
|
include(cmake/Modules/HandleVersionGeneration.cmake)
|
||||||
include(cmake/Modules/RunOnBuildDir.cmake)
|
include(cmake/Modules/RunOnBuildDir.cmake)
|
||||||
|
include(cmake/Modules/cmake_variables_helper.cmake)
|
||||||
|
|
||||||
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
pkg_config_library(LIBXML libxml-2.0 REQUIRED)
|
||||||
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
pkg_config_library(LIBSQLITE3 sqlite3 REQUIRED)
|
||||||
|
@ -467,9 +468,4 @@ if (MAKE_TESTS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# useful for debugging CMake issues
|
# useful for debugging CMake issues
|
||||||
#
|
# print_all_variables()
|
||||||
# message(STATUS "print variables")
|
|
||||||
# get_cmake_property(_variableNames VARIABLES)
|
|
||||||
# foreach(_variableName ${_variableNames})
|
|
||||||
# message(STATUS "${_variableName}=${${_variableName}}")
|
|
||||||
# endforeach()
|
|
||||||
|
|
44
cmake/Modules/cmake_variables_helper.cmake
Normal file
44
cmake/Modules/cmake_variables_helper.cmake
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
# This file contains helper macro to print env variables as status messages
|
||||||
|
|
||||||
|
# print_variable
|
||||||
|
#
|
||||||
|
# Prints a status message with the value of the variable
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# variableName - A string containing the name of the variable to be printed
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# print_variable(CMAKE_CURRENT_BINARY_DIR)
|
||||||
|
#
|
||||||
|
# Output:
|
||||||
|
# -- CMAKE_CURRENT_BINARY_DIR=/home/xxx/xxx
|
||||||
|
#
|
||||||
|
macro(print_variable _variableName)
|
||||||
|
message(STATUS "${_variableName}=${${_variableName}}")
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# print_all_variables
|
||||||
|
#
|
||||||
|
# Prints a status message for all currently defined variables.
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# none
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# print_all_variable()
|
||||||
|
#
|
||||||
|
# Output:
|
||||||
|
# -- ------------------------------ print variables ------------------------------
|
||||||
|
# -- CMAKE_CURRENT_BINARY_DIR=/home/xxx/xxx
|
||||||
|
# -- ....
|
||||||
|
# -- -----------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
macro(print_all_variables)
|
||||||
|
message(STATUS "------------------------------ print variables ------------------------------")
|
||||||
|
get_cmake_property(_variableNames VARIABLES)
|
||||||
|
|
||||||
|
foreach(_variableName ${_variableNames})
|
||||||
|
print_variable(${_variableName})
|
||||||
|
endforeach()
|
||||||
|
message(STATUS "-----------------------------------------------------------------------------")
|
||||||
|
endmacro()
|
|
@ -46,3 +46,6 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
|
||||||
TestPicture
|
TestPicture
|
||||||
TestMerge
|
TestMerge
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# useful for debugging CMake issues
|
||||||
|
# print_all_variables()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue