Skip to content

Commit

Permalink
Merge branch '74-ctk-enable-categories' Closes #74.
Browse files Browse the repository at this point in the history
* 74-ctk-enable-categories:
  Support disabling CTK_BUILD_EXAMPLES based on user changes.
  Added utility macro which allows to completely specify the option name.
  Use STATUS messages for enabling hints.
  Don't mark QT_QMAKE_EXECUTABLE as advanced.
  Add CTK_ENABLE_Python_Wrapping top-level option
  Add ctk_option_logical_expression_to_message function
  ctkMacroOptionUtils - Improve the enabling message
  New CTK_ENABLE_* build system feature.
  Removed Messaging library.
  • Loading branch information
saschazelzer committed Nov 18, 2011
2 parents a4b294e + 187b64c commit 7cac655
Show file tree
Hide file tree
Showing 23 changed files with 349 additions and 482 deletions.
20 changes: 4 additions & 16 deletions CMake/ctkBlockCheckDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# Collect CTK library target dependencies
#

ctkMacroCollectAllTargetLibraries("${CTK_LIBS_SUBDIRS}" "Libs" ALL_TARGET_LIBRARIES)
ctkMacroCollectAllTargetLibraries("${CTK_PLUGINS_SUBDIRS}" "Plugins" ALL_TARGET_LIBRARIES)
ctkMacroCollectAllTargetLibraries("${CTK_APPLICATIONS_SUBDIRS}" "Applications" ALL_TARGET_LIBRARIES)
ctkMacroCollectAllTargetLibraries("${CTK_LIBS}" "Libs" ALL_TARGET_LIBRARIES)
ctkMacroCollectAllTargetLibraries("${CTK_PLUGINS}" "Plugins" ALL_TARGET_LIBRARIES)
ctkMacroCollectAllTargetLibraries("${CTK_APPS}" "Applications" ALL_TARGET_LIBRARIES)
#message(STATUS ALL_TARGET_LIBRARIES:${ALL_TARGET_LIBRARIES})

#-----------------------------------------------------------------------------
Expand All @@ -25,19 +25,7 @@ ctkMacroCollectAllTargetLibraries("${CTK_APPLICATIONS_SUBDIRS}" "Applications" A
# of the macro ctkMacroCollectAllTargetLibraries, let's get the list of all Non-CTK dependencies.
# NON_CTK_DEPENDENCIES is expected by the macro ctkMacroShouldAddExternalProject
ctkMacroGetAllNonProjectTargetLibraries("${ALL_TARGET_LIBRARIES}" NON_CTK_DEPENDENCIES)
#message(STATUS NON_CTK_DEPENDENCIES:${NON_CTK_DEPENDENCIES})

#-----------------------------------------------------------------------------
# Include external projects
#
#-----------------------------------------------------------------------------
# Git protocole option
#
option(CTK_USE_GIT_PROTOCOL "If behind a firewall turn this OFF to use http instead." ON)
set(git_protocol "git")
if(NOT CTK_USE_GIT_PROTOCOL)
set(git_protocol "http")
endif()
#message(NON_CTK_DEPENDENCIES:${NON_CTK_DEPENDENCIES})

#-----------------------------------------------------------------------------
# Enable and setup External project global properties
Expand Down
66 changes: 66 additions & 0 deletions CMake/ctkMacroOptionUtils.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

function(ctk_option_logical_expression_to_message varname logical_expr)
set(enabling_msg)
foreach(arg ${logical_expr})
if(NOT "${${arg}}" STREQUAL "")
set(value_as_int 0)
if(${${arg}})
set(value_as_int 1)
endif()
set(enabling_msg "${enabling_msg} ${arg}:${value_as_int}")
else()
set(enabling_msg "${enabling_msg} ${arg}")
endif()
endforeach()
set(${varname} ${enabling_msg} PARENT_SCOPE)
endfunction()

macro(ctk_option option_prefix name doc default)
option(${option_prefix}_${name} ${doc} ${default})
mark_as_advanced(${option_prefix}_${name})
list(APPEND ${option_prefix}S ${name})
set(_logical_expr ${ARGN})
if(_logical_expr AND NOT ${option_prefix}_${name})
if(${ARGN})
# Force the option to ON. This is okay since the
# logical expression should contain a CTK_ENABLE_*
# option value, which requires the current option to be ON.
get_property(_doc_string CACHE ${option_prefix}_${name} PROPERTY HELPSTRING)
set(${option_prefix}_${name} ON CACHE BOOL ${_doc_string} FORCE)
# Generate user-friendly message
set(enabling_msg)
ctk_option_logical_expression_to_message(enabling_msg "${ARGN}")
message(STATUS "Enabling [${option_prefix}_${name}] because of [${enabling_msg}] evaluates to True")
endif()
endif()
endmacro()

macro(ctk_lib_option name doc default)
ctk_option(CTK_LIB ${name} ${doc} ${default} ${ARGN})
endmacro()

macro(ctk_plugin_option name doc default)
ctk_option(CTK_PLUGIN ${name} ${doc} ${default} ${ARGN})
endmacro()

macro(ctk_app_option name doc default)
ctk_option(CTK_APP ${name} ${doc} ${default} ${ARGN})
endmacro()

macro(ctk_enable_option_raw name doc default)
option(${name} "${doc}" ${default})
if(DEFINED ${name}_internal)
if(${${name}} AND ${${name}_internal})
if(NOT (${ARGN}))
get_property(_doc_string CACHE ${name} PROPERTY HELPSTRING)
set(${name} OFF CACHE BOOL ${_doc_string} FORCE)
message("Full support for [${name}] disabled")
endif()
endif()
endif()
set(${name}_internal ${${name}} CACHE INTERNAL "" FORCE)
endmacro()

macro(ctk_enable_option name doc default)
ctk_enable_option_raw(CTK_ENABLE_${name} ${doc} ${default} ${ARGN})
endmacro()
3 changes: 0 additions & 3 deletions CMake/ctkMacroSetupQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ macro(ctkMacroSetupQt)
set(minimum_required_qt_version "4.6")

find_package(Qt4)

# This option won't show up in the main CMake configure panel
mark_as_advanced(QT_QMAKE_EXECUTABLE)

if(QT4_FOUND)

Expand Down
14 changes: 7 additions & 7 deletions CMake/ctkMacroTargetLibraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ macro(ctkMacroGetAllNonProjectTargetLibraries all_target_libraries varname)
list(REMOVE_ITEM _tmp_list ${all_project_libraries})
endif()
set(${varname} ${_tmp_list})
#message(STATUS varname:${varname}:${${varname}})
#message(varname:${varname}:${${varname}})
endmacro()

#! \ingroup CMakeUtilities
macro(ctkMacroShouldAddExternalProject libraries_variable_name resultvar)
if(NOT DEFINED NON_CTK_DEPENDENCIES)
message(FATAL_ERROR "Variable NON_CTK_DEPENDENCIES is undefined !")
endif()
list(FIND NON_CTK_DEPENDENCIES ${libraries_variable_name} index)
set(${resultvar} FALSE)
if(${index} GREATER -1)
set(${resultvar} TRUE)
if(DEFINED NON_CTK_DEPENDENCIES)
list(FIND NON_CTK_DEPENDENCIES ${libraries_variable_name} index)

if(${index} GREATER -1)
set(${resultvar} TRUE)
endif()
endif()
endmacro()
Loading

0 comments on commit 7cac655

Please sign in to comment.