diff options
Diffstat (limited to 'cmake/modules')
-rw-r--r-- | cmake/modules/FindGObjectIntrospection.cmake | 3 | ||||
-rw-r--r-- | cmake/modules/GObjectIntrospectionMacros.cmake | 58 | ||||
-rw-r--r-- | cmake/modules/GtkDoc.cmake | 38 | ||||
-rw-r--r-- | cmake/modules/LibIcalMacrosInternal.cmake | 9 |
4 files changed, 73 insertions, 35 deletions
diff --git a/cmake/modules/FindGObjectIntrospection.cmake b/cmake/modules/FindGObjectIntrospection.cmake index 02841f4f..07098b82 100644 --- a/cmake/modules/FindGObjectIntrospection.cmake +++ b/cmake/modules/FindGObjectIntrospection.cmake @@ -16,6 +16,7 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Get gobject-introspection's specified pkg-config variable macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname) execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0 @@ -27,7 +28,7 @@ macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname) else() string(REGEX REPLACE "[\r\n]" " " _result "${_result}") string(REGEX REPLACE " +$" "" _result "${_result}") - separate_arguments(_result) + separate_arguments(_result UNIX_COMMAND ${_result}) set(${_outvar} ${_result} CACHE INTERNAL "") endif() endmacro(_GIR_GET_PKGCONFIG_VAR) diff --git a/cmake/modules/GObjectIntrospectionMacros.cmake b/cmake/modules/GObjectIntrospectionMacros.cmake index d8b37f29..69b7e78f 100644 --- a/cmake/modules/GObjectIntrospectionMacros.cmake +++ b/cmake/modules/GObjectIntrospectionMacros.cmake @@ -3,6 +3,7 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# Generate list from another list, but with each item prepended with a prefix macro(_gir_list_prefix _outvar _listvar _prefix) set(${_outvar}) foreach(_item IN LISTS ${_listvar}) @@ -10,13 +11,12 @@ macro(_gir_list_prefix _outvar _listvar _prefix) endforeach() endmacro(_gir_list_prefix) +# cmake-lint: disable=R0915 macro(gir_add_introspections introspections_girs) - set(_gir_girs) set(_gir_typelibs) foreach(gir IN LISTS ${introspections_girs}) - set(_gir_name "${gir}") ## Transform the gir filename to something which can reference through a variable @@ -65,7 +65,6 @@ macro(gir_add_introspections introspections_girs) message(ERROR "Unspecified or empty ${_gir_name}_FILES variable") endif() - # Variables which provides a list of things _gir_list_prefix(_gir_libraries ${_gir_name}_LIBS "--library=") _gir_list_prefix(_gir_packages ${_gir_name}_PACKAGES "--pkg=") @@ -75,45 +74,54 @@ macro(gir_add_introspections introspections_girs) set(_gir_libtool "--no-libtool") add_custom_command( - COMMAND ${GObjectIntrospection_SCANNER} - ${GObjectIntrospection_SCANNER_ARGS} - --namespace=${_gir_namespace} - --nsversion=${_gir_version} - ${_gir_libtool} - ${_gir_program} - ${_gir_libraries} - ${_gir_packages} - ${_gir_includes} - ${_gir_scannerflags} - ${${_gir_name}_CFLAGS} - ${_gir_files} - --output ${CMAKE_CURRENT_BINARY_DIR}/${gir} - --accept-unprefixed - DEPENDS ${_gir_files} - ${${_gir_name}_LIBS} OUTPUT ${gir} + COMMAND ${GObjectIntrospection_SCANNER} + ${GObjectIntrospection_SCANNER_ARGS} + --namespace=${_gir_namespace} + --nsversion=${_gir_version} + ${_gir_libtool} + ${_gir_program} + ${_gir_libraries} + ${_gir_packages} + ${_gir_includes} + ${_gir_scannerflags} + ${${_gir_name}_CFLAGS} + ${_gir_files} + --output ${CMAKE_CURRENT_BINARY_DIR}/${gir} + --accept-unprefixed + DEPENDS ${_gir_files} ${${_gir_name}_LIBS} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM + COMMENT "Run the gobject introspection scanner" ) list(APPEND _gir_girs ${CMAKE_CURRENT_BINARY_DIR}/${gir}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION ${SHARE_INSTALL_DIR}/gir-1.0) string(REPLACE ".gir" ".typelib" _typelib "${gir}") add_custom_command( + OUTPUT ${_typelib} COMMAND ${GObjectIntrospection_COMPILER} - --includedir=. - ${CMAKE_CURRENT_BINARY_DIR}/${gir} - -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} + --includedir=. + ${CMAKE_CURRENT_BINARY_DIR}/${gir} + -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir} - OUTPUT ${_typelib} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Run the gobject introspection compiler" ) list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION ${LIB_INSTALL_DIR}/girepository-1.0) endforeach() - add_custom_target(gir-girs-${_gir_name} ALL DEPENDS ${_gir_girs}) - add_custom_target(gir-typelibs-${_gir_name} ALL DEPENDS ${_gir_typelibs}) + add_custom_target(gir-girs-${_gir_name} + ALL + DEPENDS ${_gir_girs} + COMMENT "Target for the gobject introspection compiler" + ) + add_custom_target(gir-typelibs-${_gir_name} + ALL + DEPENDS ${_gir_typelibs} + COMMENT "Target for the gobject introspection typelibs" + ) endmacro(gir_add_introspections) diff --git a/cmake/modules/GtkDoc.cmake b/cmake/modules/GtkDoc.cmake index d32d4b18..4234cbb0 100644 --- a/cmake/modules/GtkDoc.cmake +++ b/cmake/modules/GtkDoc.cmake @@ -30,13 +30,14 @@ if(NOT (GTKDOC_SCAN AND GTKDOC_MKDB AND GTKDOC_MKHTML AND GTKDOC_FIXXREF)) endif() if(NOT TARGET gtkdocs) - add_custom_target(gtkdocs ALL) + add_custom_target(gtkdocs ALL COMMENT "Target to run gtkdoc for all modules") endif() if(NOT TARGET gtkdoc-rebuild-sgmls) - add_custom_target(gtkdoc-rebuild-sgmls) + add_custom_target(gtkdoc-rebuild-sgmls COMMENT "Target to rebuild sgml for all modules") endif() +# cmake-lint: disable=R0912,R0915 macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ignoreheadersvar) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in @@ -55,7 +56,10 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign if(APPLE) if(NOT DEFINED ENV{XML_CATALOG_FILES}) - message(FATAL_ERROR "On OSX, please run \'export XML_CATALOG_FILES=/usr/local/etc/xml/catalog\' first; else the gtk entities cannot be located.") + message(FATAL_ERROR + "On OSX, please run \'export XML_CATALOG_FILES=/usr/local/etc/xml/catalog\' first; " + "else the gtk entities cannot be located." + ) endif() endif() @@ -69,7 +73,9 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign if(TARGET ${opt}) set(_target_type) get_target_property(_target_type ${opt} TYPE) - if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL "SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY")) + if((_target_type STREQUAL "STATIC_LIBRARY") OR + (_target_type STREQUAL "SHARED_LIBRARY") OR + (_target_type STREQUAL "MODULE_LIBRARY")) set(_compile_options) set(_link_libraries) @@ -107,7 +113,9 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign if(TARGET ${opt}) set(_target_type) get_target_property(_target_type ${opt} TYPE) - if((_target_type STREQUAL "STATIC_LIBRARY") OR (_target_type STREQUAL "SHARED_LIBRARY") OR (_target_type STREQUAL "MODULE_LIBRARY")) + if((_target_type STREQUAL "STATIC_LIBRARY") OR + (_target_type STREQUAL "SHARED_LIBRARY") OR + (_target_type STREQUAL "MODULE_LIBRARY")) set(_output_name "") get_target_property(_output_name ${opt} OUTPUT_NAME) if(NOT _output_name) @@ -181,7 +189,11 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/html" - COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/html" ${GTKDOC_MKHTML} --path=.. ${_module} ../${_module}-docs.sgml + COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}/html" + ${GTKDOC_MKHTML} + --path=.. + ${_module} + ../${_module}-docs.sgml COMMAND ${GTKDOC_FIXXREF} --module=${_module} @@ -197,6 +209,7 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign add_custom_target(gtkdoc-${_module} DEPENDS html/index.html + COMMENT "Target for running gtkdoc for module" ) if(${_depsvar}) @@ -226,7 +239,9 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign --rebuild-types ${_srcdirs} - COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}" ${_scangobj_prefix} ${GTKDOC_SCANGOBJ} + COMMAND ${CMAKE_COMMAND} -E chdir "${CMAKE_CURRENT_BINARY_DIR}" + ${_scangobj_prefix} + ${GTKDOC_SCANGOBJ} --module=${_module} ${_scangobj_cflags} ${_scangobj_ldflags} @@ -240,9 +255,14 @@ macro(add_gtkdoc _module _namespace _deprecated_guards _srcdirsvar _depsvar _ign --output-format=xml ${_srcdirs} - COMMAND ${CMAKE_COMMAND} -E rename ${CMAKE_CURRENT_BINARY_DIR}/tmp/${_module}-docs.sgml ${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in + COMMAND ${CMAKE_COMMAND} -E rename + ${CMAKE_CURRENT_BINARY_DIR}/tmp/${_module}-docs.sgml + ${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in - COMMAND ${CMAKE_COMMAND} -E echo "File '${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in' overwritten, make sure you replace generated strings with proper content before committing." + COMMAND ${CMAKE_COMMAND} -E echo + "File '${CMAKE_CURRENT_SOURCE_DIR}/${_module}-docs.sgml.in' overwritten, " + "make sure to replace generated strings with proper content before committing." + COMMENT "Target to rebuild the sgml for the specified module" ) add_dependencies(gtkdoc-rebuild-sgmls gtkdoc-rebuild-${_module}-sgml) diff --git a/cmake/modules/LibIcalMacrosInternal.cmake b/cmake/modules/LibIcalMacrosInternal.cmake index ed197a15..bc527636 100644 --- a/cmake/modules/LibIcalMacrosInternal.cmake +++ b/cmake/modules/LibIcalMacrosInternal.cmake @@ -3,12 +3,14 @@ include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) +# Call option() and then add_feature_info() function(libical_option option description) set(extra_option_arguments ${ARGN}) option(${option} "${description}" ${extra_option_arguments}) add_feature_info("Option ${option}" ${option} "${description}") endfunction() +# Warn about deprecated cmake options then call libical_option function(libical_deprecated_option deprecated_option option description) set(extra_option_arguments ${ARGN}) if(${deprecated_option}) @@ -18,6 +20,7 @@ function(libical_deprecated_option deprecated_option option description) libical_option(${option} "${description}" ${extra_option_arguments}) endfunction() +# If condition is True, append the specified value to each ARGN function(libical_append_if condition value) if(${condition}) foreach(variable ${ARGN}) @@ -26,11 +29,17 @@ function(libical_append_if condition value) endif() endfunction() +# Create a variable C_SUPPORTS_<flag> with a boolean denoting +# if the C compiler supports that flag; if so, append the flag +# to the global CMAKE_C_FLAGS variable. macro(libical_add_cflag flag name) check_c_compiler_flag("${flag}" "C_SUPPORTS_${name}") libical_append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS) endmacro() +# Create a variable CXX_SUPPORTS_<flag> with a boolean denoting +# if the C++ compiler supports that flag; if so, append the flag +# to the global CMAKE_CXX_FLAGS variable. macro(libical_add_cxxflag flag name) check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${name}") libical_append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS) |