[Conf] More robust way to derive Boost.Python component

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -70,6 +70,8 @@
 #  * INSTALL_INCLUDE_DIR  - Installation directory for the header files
 #  * INSTALL_DATA_DIR     - Installation directory for the data files
 #  * INSTALL_SAMPLE_DIR   - Installation directory for the (CSV) sample files
+#  * NEED_PYTHON          - Whether Python libraries are needed
+#                           That paremeter is derived from the required libraries
 #  * RUN_GCOV             - Whether or not to perform code coverage
 #
 macro (set_project_options _build_doc _enable_tests _run_gcov)
@@ -106,6 +108,7 @@
   set (CSS_ALL_TARGETS)
   set (IMG_ALL_TARGETS)
   set (MAN_ALL_TARGETS)
+  set (NEED_PYTHON OFF)

   # Set the library installation directory (either 32 or 64 bits)
   set (LIBDIR "lib${LIB_SUFFIX}" CACHE PATH
@@ -335,6 +338,7 @@
     endif (${_arg_lower} STREQUAL "lcov")

     if (${_arg_lower} STREQUAL "python")
+      set (NEED_PYTHON ON)
       get_python (${_arg_version})
     endif (${_arg_lower} STREQUAL "python")

@@ -616,19 +620,37 @@
   #         On some platform/Boost version combinations, the Python version
   #         may be just the major version (2 or 3 as of 2020) or the major
   #         and minor versions (e.g., 27, 28, 34, 36, 37, 38, 39 as of 2020)
-  set (python_cpt_name1 "python${Python3_VERSION_MAJOR}")
-  set (python_cpt_name2 "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
+  # Note 3: Boot.Python has is reuired only for Python extensions. It should
+  #         not be linked with other regular (non-Python) libraries/binaries,
+  #         as it pulls with it symbols from the Python interpreter, which are
+  #         available only when launched from a Python interpreter.
   set (Boost_USE_STATIC_LIBS OFF)
   set (Boost_USE_MULTITHREADED ON)
   set (Boost_USE_STATIC_RUNTIME OFF)
+  # Boost.Python - Depending on the platforms, the component name
+  # differs. We try all of them, and the find_package() will retrieve
+  # just one
+  if (NEED_PYTHON)
+    set (python_cpt_name0 "python")
+    #
+    if (Python3_VERSION_MAJOR)
+      set (python_cpt_name1 "python${Python3_VERSION_MAJOR}")
+    endif (Python3_VERSION_MAJOR)
+    #
+    if (Python3_VERSION_MINOR)
+      set (python_cpt_name2 "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
+    endif (Python3_VERSION_MINOR)
+  endif (NEED_PYTHON)

   # Boost components for (non-Python) libraries
   set (BOOST_REQUIRED_COMPONENTS_FOR_LIB
     date_time random iostreams serialization filesystem system locale regex)

   # Boost components for Python extensions
-  set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT
-	${python_cpt_name1} ${python_cpt_name2})
+  if (NEED_PYTHON)
+    set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT
+      ${python_cpt_name0} ${python_cpt_name1} ${python_cpt_name2})
+  endif (NEED_PYTHON)

   # Boost components for main (non-test) binaries
   set (BOOST_REQUIRED_COMPONENTS_FOR_BIN program_options)
@@ -655,54 +677,61 @@
   find_package (BoostWrapper ${_required_version} REQUIRED)

   if (Boost_FOUND)
-    # Boost.Python library
-	if (${Boost_PYTHON3_FOUND})
-      message (STATUS "  + Boost_PYTHON3_FOUND: ${Boost_PYTHON3_FOUND}")
-	endif (${Boost_PYTHON3_FOUND})
-	#
-	if (${Boost_PYTHON38_FOUND})
-      message (STATUS "  + Boost_PYTHON38_FOUND: ${Boost_PYTHON38_FOUND}")
-	endif (${Boost_PYTHON38_FOUND})
-	#
-	if (${Boost_PYTHON_VERSION})
+
+    if (NEED_PYTHON)
+      # Boost has a single Python library, but its name depends on the
+      # distribution, it can be libboost_python3 or libboost_python3x
+      if (Boost_PYTHON_LIBRARY)
+	set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT ${python_cpt_name0})
+	if (Python3_VERSION_MAJOR)
+	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name1})
+	endif (Python3_VERSION_MAJOR)
+	if (Python3_VERSION_MINOR)
+	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name2})
+	endif (Python3_VERSION_MINOR)
+      endif (Boost_PYTHON_LIBRARY)
+
+      #
+      if (Boost_PYTHON${Python3_VERSION_MAJOR}_LIBRARY)
+	set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT ${python_cpt_name1})
+	list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name0})
+	if (Python3_VERSION_MINOR)
+	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name2})
+	endif (Python3_VERSION_MINOR)
+      endif (Boost_PYTHON${Python3_VERSION_MAJOR}_LIBRARY)
+
+      #
+      if (Boost_PYTHON${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}_LIBRARY)
+	set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT ${python_cpt_name2})
+	list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name0})
+	if (Python3_VERSION_MAJOR)
+	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name1})
+	endif (Python3_VERSION_MAJOR)
+      endif (Boost_PYTHON${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}_LIBRARY)
+
+      # Reporting
+      message (STATUS "  + Retained Boost Python component: ${BOOST_REQUIRED_COMPONENTS_FOR_PYEXT}")
+
+      # Derive the Boost.Python component name (amoung Boost_PYTHON,
+      # Boost_PYTHON3, Boost_PYTHON3X)
+      string (TOUPPER ${BOOST_REQUIRED_COMPONENTS_FOR_PYEXT} _python_cpt)
+
+      # Reporting
+      message (STATUS "  + Boost Python component: Boost_${_python_cpt}")
+
+      # Derive the Python version used by Boost.Python
+      if (${Boost_${_python_cpt}_LIBRARY} MATCHES "python([1-9])\\.?([0-9])?")
+	set (Boost_PYTHON_VERSION "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
+      endif (${Boost_${_python_cpt}_LIBRARY} MATCHES "python([1-9])\\.?([0-9])?")
+
+      # Reporting
       message (STATUS "  + Boost_PYTHON_VERSION: ${Boost_PYTHON_VERSION}")
-	endif (${Boost_PYTHON_VERSION})
-	#
-	if (${Boost_PYTHON_LIBRARY})
-      message (STATUS "  + Boost_PYTHON_LIBRARY: ${Boost_PYTHON_LIBRARY}")
-	endif (${Boost_PYTHON_LIBRARY})
-	#
-	if (${Boost_PYTHON3_LIBRARY})
-      message (STATUS "  + Boost_PYTHON3_LIBRARY: ${Boost_PYTHON3_LIBRARY}")
-	endif (${Boost_PYTHON3_LIBRARY})
-	#
-	if (${Boost_PYTHON36_LIBRARY})
-      message (STATUS "  + Boost_PYTHON36_LIBRARY: ${Boost_PYTHON36_LIBRARY}")
-	endif (${Boost_PYTHON36_LIBRARY})
-	#
-	if (${Boost_PYTHON37_LIBRARY})
-      message (STATUS "  + Boost_PYTHON37_LIBRARY: ${Boost_PYTHON37_LIBRARY}")
-	endif (${Boost_PYTHON37_LIBRARY})
-	#
-	if (${Boost_PYTHON38_LIBRARY})
-      message (STATUS "  + Boost_PYTHON38_LIBRARY: ${Boost_PYTHON38_LIBRARY}")
-	endif (${Boost_PYTHON38_LIBRARY})
-	#
-	if (${Boost_PYTHON39_LIBRARY})
-      message (STATUS "  + Boost_PYTHON39_LIBRARY: ${Boost_PYTHON39_LIBRARY}")
-	endif (${Boost_PYTHON39_LIBRARY})
-
-	# Boost has a single Python library, but its name depends on the
-	# distribution, it can be libboost_python3 or libboost_python3x
-	if (${Boost_PYTHON3_FOUND})
-	  set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT ${python_cpt_name1})
-	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name2})
-	endif (${Boost_PYTHON3_FOUND})
-
-	if (${Boost_PYTHON${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}_FOUND})
-	  set (BOOST_REQUIRED_COMPONENTS_FOR_PYEXT ${python_cpt_name2})
-	  list (REMOVE_ITEM BOOST_REQUIRED_COMPONENTS ${python_cpt_name1})
-	endif (${Boost_PYTHON${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}_FOUND})
+
+      # Boost.Python library
+      if (Boost_${_python_cpt}_LIBRARY)
+	message (STATUS "  + Boost_${_python_cpt}_LIBRARY: ${Boost_${_python_cpt}_LIBRARY}")
+      endif (Boost_${_python_cpt}_LIBRARY)
+    endif (NEED_PYTHON)

     # Update the list of include directories for the project
     include_directories (${Boost_INCLUDE_DIRS})
@@ -715,8 +744,10 @@
       "${BOOST_REQUIRED_COMPONENTS_FOR_LIB}")

     # Update the list of Python library dependencies for the project
-    register_boost_lib ("PROJ_DEP_LIBS_FOR_PYEXT"
-      "${BOOST_REQUIRED_COMPONENTS_FOR_PYEXT}")
+    if (NEED_PYTHON)
+      register_boost_lib ("PROJ_DEP_LIBS_FOR_PYEXT"
+	"${BOOST_REQUIRED_COMPONENTS_FOR_PYEXT}")
+    endif (NEED_PYTHON)

     # Update the list of binary dependencies for the project
     register_boost_lib ("PROJ_DEP_LIBS_FOR_BIN"
@@ -772,22 +803,22 @@

   set (${_proto_srcs})
   foreach (FIL ${ARGN})
-	# Extract the file-path and the extension of the Protobuf specification file
+    # Extract the file-path and the extension of the Protobuf specification file
     get_filename_component (ABS_FIL ${FIL} ABSOLUTE)
     get_filename_component (FIL_WE ${FIL} NAME_WE)

-	# With Python, Protobuf adds "_pb2"
-	set (_proto_gen_src ${FIL_WE}_pb2.py)
-
-	message (STATUS
-	  "Adding ${CMAKE_CURRENT_BINARY_DIR}/${_proto_gen_src} to Python sources")
+    # With Python, Protobuf adds "_pb2"
+    set (_proto_gen_src ${FIL_WE}_pb2.py)
+
+    message (STATUS
+      "Adding ${CMAKE_CURRENT_BINARY_DIR}/${_proto_gen_src} to Python sources")

     list (APPEND ${_proto_srcs} "${CMAKE_CURRENT_BINARY_DIR}/${_proto_gen_src}")

-	# Add a specific command for the Protobuf stub/skeleton generation
+    # Add a specific command for the Protobuf stub/skeleton generation
     add_custom_command (OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_proto_gen_src}"
       COMMAND  ${PROTOBUF_PROTOC_EXECUTABLE}
-	  --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+      --python_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
       DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
       COMMENT "Running Python protocol buffer compiler on ${FIL}, generating ${CMAKE_CURRENT_BINARY_DIR}/${_proto_gen_src}"
       VERBATIM)
@@ -1852,10 +1883,10 @@
   endif (${_lib_short_name} STREQUAL ${MODULE_NAME})

   ##
-  # Python extension libraries hase some peculiarities
+  # Python extension libraries has some peculiarities
   if ("${_lib_prefix}" STREQUAL "py")
-	message (STATUS "${_lib_short_name} is assumed to be a Python library:")
-	message (STATUS "  -> Following libraries will be weakly linked: ${Python3_LIBRARIES} ${PROJ_DEP_LIBS_FOR_PYEXT}")
+    message (STATUS "${_lib_short_name} is assumed to be a Python library:")
+    message (STATUS "  -> Following libraries will be weakly linked: ${Python3_LIBRARIES} ${PROJ_DEP_LIBS_FOR_PYEXT}")

     # no 'lib' prefix
     set_target_properties (${_lib_target} PROPERTIES PREFIX "")
@@ -1863,34 +1894,34 @@
     # The suffix must be .so (even on MacOS, not .dylib)
     set_target_properties (${_lib_target} PROPERTIES SUFFIX ".so")

-	# Add the dependencies for Python extensions.
-	#
-	# Python extensions (which are also libraries per se) must not be linked
-	# against libpython3.x.so (which includes the interpreter). On Linux, it is
-	# fine not to link against libpython3.x.so, but on OS X, the compiler
-	# fails, unless the -undefined dynamic_lookup option is passed, which is
-	# what target_link_libraries_with_dynamic_lookup() is doing. That function
-	# is specified in the targetLinkLibrariesWithDynamicLookup.cmake file.
-	#
-	# See also:
-	#  https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/
-	#  https://github.com/scikit-build/scikit-build/blob/master/skbuild/resources/cmake/targetLinkLibrariesWithDynamicLookup.cmake
-	target_link_libraries_with_dynamic_lookup (${_lib_target}
-	  ${Python3_LIBRARIES} ${PROJ_DEP_LIBS_FOR_PYEXT})
-	#python_extension_module (${_lib_target})
+    # Add the dependencies for Python extensions.
+    #
+    # Python extensions (which are also libraries per se) must not be linked
+    # against libpython3.x.so (which includes the interpreter). On Linux, it is
+    # fine not to link against libpython3.x.so, but on OS X, the compiler
+    # fails, unless the -undefined dynamic_lookup option is passed, which is
+    # what target_link_libraries_with_dynamic_lookup() is doing. That function
+    # is specified in the targetLinkLibrariesWithDynamicLookup.cmake file.
+    #
+    # See also:
+    #  https://blog.tim-smith.us/2015/09/python-extension-modules-os-x/
+    #  https://github.com/scikit-build/scikit-build/blob/master/skbuild/resources/cmake/targetLinkLibrariesWithDynamicLookup.cmake
+    target_link_libraries_with_dynamic_lookup (${_lib_target}
+      ${Python3_LIBRARIES} ${PROJ_DEP_LIBS_FOR_PYEXT})
+    #python_extension_module (${_lib_target})

   endif ("${_lib_prefix}" STREQUAL "py")

   ##
   # Library name (and soname)
   if (WIN32)
-	# MS Windows
+    # MS Windows
     set_target_properties (${_lib_target} PROPERTIES
       OUTPUT_NAME ${_lib_short_name}
       VERSION ${GENERIC_LIB_VERSION})

   else (WIN32)
-	# Linux and MacOS
+    # Linux and MacOS
     set_target_properties (${_lib_target} PROPERTIES
       OUTPUT_NAME ${_lib_short_name}
       VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
@@ -1907,15 +1938,15 @@
   ##
   # Installation of the library
   if ("${_lib_prefix}" STREQUAL "py")
-	# If the library is Python, install it into a dedicated directory
-	message (STATUS "${_lib_short_name} is assumed to be a Python library")
-	install (TARGETS ${_lib_target}
+    # If the library is Python, install it into a dedicated directory
+    message (STATUS "${_lib_short_name} is assumed to be a Python library")
+    install (TARGETS ${_lib_target}
       EXPORT ${LIB_DEPENDENCY_EXPORT}
       LIBRARY DESTINATION "${INSTALL_PY_LIB_DIR}" COMPONENT runtime)
-
+
   else ("${_lib_prefix}" STREQUAL "py")
-	# Install the library in the standard location
-	install (TARGETS ${_lib_target}
+    # Install the library in the standard location
+    install (TARGETS ${_lib_target}
       EXPORT ${LIB_DEPENDENCY_EXPORT}
       LIBRARY DESTINATION "${INSTALL_LIB_DIR}" COMPONENT runtime)
   endif ("${_lib_prefix}" STREQUAL "py")
@@ -2673,7 +2704,7 @@

 # Python
 macro (display_python)
-  if (Python3_FOUND)
+  if (NEED_PYTHON)
     message (STATUS)
     message (STATUS "* Python:")
     message (STATUS "  - Python3_VERSION ............... : ${Python3_VERSION}")
@@ -2682,7 +2713,10 @@
     message (STATUS "  - Python3_LIBRARIES ............. : ${Python3_LIBRARIES}")
     message (STATUS "  - Python3_LIBRARY_DIRS .......... : ${Python3_LIBRARY_DIRS}")
     message (STATUS "  - Python3_RUNTIME_LIBRARY_DIRS .. : ${Python3_RUNTIME_LIBRARY_DIRS}")
-  endif (Python3_FOUND)
+  else (NEED_PYTHON)
+    message (STATUS)
+    message (STATUS "* Python not required")
+  endif (NEED_PYTHON)
 endmacro (display_python)

 # ICU
@@ -2717,7 +2751,9 @@
     message (STATUS "  - Boost_LIB_VERSION ............. : ${Boost_LIB_VERSION}")
     message (STATUS "  - Boost_HUMAN_VERSION ........... : ${Boost_HUMAN_VERSION}")
     message (STATUS "  - Boost_INCLUDE_DIRS ............ : ${Boost_INCLUDE_DIRS}")
-    message (STATUS "  - Boost_PYTHON_VERSION .......... : ${Boost_PYTHON_VERSION}")
+    if (NEED_PYTHON)
+      message (STATUS "  - Boost_PYTHON_VERSION .......... : ${Boost_PYTHON_VERSION}")
+    endif (NEED_PYTHON)
     message (STATUS "  - Boost required components ..... : ${BOOST_REQUIRED_COMPONENTS}")
     message (STATUS "  - Boost required libraries ...... : ${BOOST_REQUIRED_LIBS}")
     message (STATUS "  - Boost required libs for Py ext. : ${PROJ_DEP_LIBS_FOR_PYEXT}")


[Config][CMake] Migrated to new FindPython3 (from deprecated FindPythonLibs)

--- config/project_config_embeddable.cmake
+++ config/project_config_embeddable.cmake
@@ -479,48 +479,36 @@
   unset (_required_version)
   if (${ARGC} GREATER 0)
     set (_required_version ${ARGV0})
-    message (STATUS "Requires PythonLibs-${_required_version}")
+    message (STATUS "Requires Python with version ${_required_version}; however just Python3 is considered here")
   else (${ARGC} GREATER 0)
-    message (STATUS "Requires PythonLibs without specifying any version")
+    message (STATUS "Requires Python3; any version will do")
   endif (${ARGC} GREATER 0)

   # The first check searches for the libraries and include paths.
   # However, on some older versions (e.g., on RedHat/CentOS 5.x),
   # only the static library is searched.
-  find_package (PythonLibs ${_required_version} REQUIRED)
+  find_package (Python3 COMPONENTS Interpreter Development REQUIRED)

   # The second check is to get the dynamic library for sure.
-  find_package (PythonLibsWrapper ${_required_version} REQUIRED)
-
-  if (PYTHONLIBS_FOUND)
-	# Derive the version of Python (for whatever reason, FindPythonLibs
-	# does not seem to provide that version variable.
-	get_filename_component (PYTHONLIBS_LIB_FILENAME ${PYTHON_LIBRARIES} NAME)
-	string (REGEX REPLACE "^libpython([0-9]+.[0-9]+).*$" "\\1"
-	  PYTHONLIBS_VERSION "${PYTHONLIBS_LIB_FILENAME}")
-
-	if (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])")
-	  set (PY_MAJOR_VERSION "${CMAKE_MATCH_1}")
-	  set (PY_MINOR_VERSION "${CMAKE_MATCH_2}")
-	  set (PY_PATCH_VERSION "${CMAKE_MATCH_3}")
-	endif (${PYTHONLIBS_VERSION_STRING} MATCHES "([0-9]).([0-9]).([0-9])")
-
-	message (STATUS "Found PythonLibs ${PYTHONLIBS_VERSION} (${PYTHONLIBS_VERSION_STRING} / ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION})")
-
-	# Set the Python installation directory
-	set (INSTALL_PY_LIB_DIR
-	  ${INSTALL_LIB_DIR}/python${PYTHONLIBS_VERSION}/site-packages/py${PROJECT_NAME}
-	  CACHE PATH "Installation directory for Python libraries")
-
-	# Update the list of include directories for the project
-    include_directories (${PYTHON_INCLUDE_DIRS})
+  #find_package (PythonLibsWrapper ${_required_version} REQUIRED)
+
+  if (Python3_FOUND)
+    message (STATUS "Found Python3 ${Python3_VERSION} (${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_PATCH})")
+
+    # Set the Python installation directory
+    set (INSTALL_PY_LIB_DIR
+      ${INSTALL_LIB_DIR}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}/site-packages/py${PROJECT_NAME}
+      CACHE PATH "Installation directory for Python libraries")
+
+    # Update the list of include directories for the project
+    include_directories (${Python3_INCLUDE_DIRS})

     # Update the list of dependencies for the project
-    list (APPEND PROJ_DEP_LIBS_FOR_LIB ${PYTHON_LIBRARIES})
-
-  else (PYTHONLIBS_FOUND)
+    list (APPEND PROJ_DEP_LIBS_FOR_LIB ${Python3_LIBRARIES})
+
+  else (Python3_FOUND)
 	message (FATAL_ERROR "Python libraries are missing. Please install them (e.g., 'python-devel' for the Fedora/RedHat package)")
-  endif (PYTHONLIBS_FOUND)
+  endif (Python3_FOUND)

 endmacro (get_python)

@@ -618,8 +606,8 @@
   #         On some platform/Boost version combinations, the Python version
   #         may be just the major version (2 or 3 as of 2019) or the major
   #         and minor versions (e.g., 27, 28, 34, 36, 37 as of 2019)
-  set (python_cpt_name1 "python${PY_MAJOR_VERSION}")
-  set (python_cpt_name2 "python${PY_MAJOR_VERSION}${PY_MINOR_VERSION}")
+  set (python_cpt_name1 "python${Python3_VERSION_MAJOR}")
+  set (python_cpt_name2 "python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}")
   set (Boost_USE_STATIC_LIBS OFF)
   set (Boost_USE_MULTITHREADED ON)
   set (Boost_USE_STATIC_RUNTIME OFF)
@@ -1473,7 +1461,7 @@
   set (exec_prefix   ${prefix})
   set (bindir        ${exec_prefix}/bin)
   set (libdir        ${exec_prefix}/${LIBDIR})
-  set (pylibdir	     ${libdir}/python${PYTHONLIBS_VERSION}/site-packages/py${PACKAGE})
+  set (pylibdir	     ${libdir}/python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR}/site-packages/py${PACKAGE})
   set (libexecdir    ${exec_prefix}/libexec)
   set (sbindir       ${exec_prefix}/sbin)
   set (sysconfdir    ${prefix}/etc)
@@ -2555,27 +2543,26 @@

 # Python
 macro (display_python)
-  if (PYTHONLIBS_FOUND)
+  if (Python3_FOUND)
     message (STATUS)
-	message (STATUS "* Python:")
-	message (STATUS "  - PYTHONLIBS_VERSION ............ : ${PYTHONLIBS_VERSION}")
-	message (STATUS "  - PY_{MAJOR,MINOR,PATCH}_VERSION  : ${PY_MAJOR_VERSION}.${PY_MINOR_VERSION}.${PY_PATCH_VERSION}")
-	message (STATUS "  - PYTHON_LIBRARIES .............. : ${PYTHON_LIBRARIES}")
-	message (STATUS "  - PYTHON_INCLUDE_PATH ........... : ${PYTHON_INCLUDE_PATH}")
-	message (STATUS "  - PYTHON_INCLUDE_DIRS ........... : ${PYTHON_INCLUDE_DIRS}")
-	message (STATUS "  - PYTHON_DEBUG_LIBRARIES ........ : ${PYTHON_DEBUG_LIBRARIES}")
-	message (STATUS "  - Python_ADDITIONAL_VERSIONS .... : ${Python_ADDITIONAL_VERSIONS}")
-  endif (PYTHONLIBS_FOUND)
+    message (STATUS "* Python:")
+    message (STATUS "  - Python3_VERSION ............... : ${Python3_VERSION}")
+    message (STATUS "  - Python3_VERSION_{MJR,MNR,PTCH}  : ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}.${Python3_VERSION_PATCH}")
+    message (STATUS "  - Python3_INCLUDE_DIRS .......... : ${Python3_INCLUDE_DIRS}")
+    message (STATUS "  - Python3_LIBRARIES ............. : ${Python3_LIBRARIES}")
+    message (STATUS "  - Python3_LIBRARY_DIRS .......... : ${Python3_LIBRARY_DIRS}")
+    message (STATUS "  - Python3_RUNTIME_LIBRARY_DIRS .. : ${Python3_RUNTIME_LIBRARY_DIRS}")
+  endif (Python3_FOUND)
 endmacro (display_python)

 # ICU
 macro (display_icu)
   if (ICU_FOUND)
     message (STATUS)
-	message (STATUS "* ICU:")
-	message (STATUS "  - ICU_VERSION ................... : ${ICU_VERSION}")
-	message (STATUS "  - ICU_LIBRARIES ................. : ${ICU_LIBRARIES}")
-	message (STATUS "  - ICU_INCLUDE_DIRS .............. : ${ICU_INCLUDE_DIR}")
+    message (STATUS "* ICU:")
+    message (STATUS "  - ICU_VERSION ................... : ${ICU_VERSION}")
+    message (STATUS "  - ICU_LIBRARIES ................. : ${ICU_LIBRARIES}")
+    message (STATUS "  - ICU_INCLUDE_DIRS .............. : ${ICU_INCLUDE_DIR}")
   endif (ICU_FOUND)
 endmacro (display_icu)


Update dependencies.

Update dependencies.

--- build/cmake/versions.cmake
+++ build/cmake/versions.cmake
@@ -6,8 +6,8 @@
 set(ELASTICSEARCH_HASH 23353fcfdf4897997eb36624afa0af62562f9b3c)
 set(FLUME_VERSION 1.6.0)
 set(FLUME_HASH defd21ad8d2b6f28cc0a16b96f652099)
-set(GLIDE_VERSION 0.10.1)
-set(GLIDE_HASH b738e5c25f51c638313a9532ebb22f33)
+set(GLIDE_VERSION 0.10.2)
+set(GLIDE_HASH 9cf39f7278b34cebce6cd0ea2860b61f)
 set(GOLANG_VERSION 1.5.3)
 set(GOLANG_HASH 43afe0c5017e502630b1aea4d44b8a7f059bf60d7f29dfd58db454d4e4e0ae53)
 # Newer version from git fixes https://github.com/json-c/json-c/issues/159
@@ -29,7 +29,7 @@
 set(LUAROCK_ARGPARSE_VERSION 0.4.1-1)
 set(LUAROCK_CMSGPACK_VERSION 0.4.0-0)
 set(LUAROCK_ICONV_VERSION 7-1)
-set(LUAROCK_INSPECT_VERSION 3.0-4)
+set(LUAROCK_INSPECT_VERSION 3.1.0-1)
 set(LUAROCK_LIBCIDR_VERSION 0.1.0-1)
 set(LUAROCK_LUACHECK_VERSION 0.14.0-1)
 set(LUAROCK_LUAPOSIX_VERSION 33.4.0-1)
@@ -51,8 +51,8 @@
 set(MONGODB_HASH ce20c4caac31c49aaf10ca44c703a9ed)
 set(MORA_VERSION fea22d544a961ef5cd66dde405cf452b1ae33d2c)
 set(MORA_HASH 1e9c63acbbb0795ed00820a59c6cdcbc)
-set(NGX_DYUPS_VERSION 8c3ef150538c3fd643f9e47dd94df4722c8c3e4a)
-set(NGX_DYUPS_HASH 95de90f77a5bc08c6d653cdc45d3535c)
+set(NGX_DYUPS_VERSION f4bc212bdc64334c5eaf871015c9e21dae7d0c13)
+set(NGX_DYUPS_HASH aadb55c3ad5a558b1264ccb848a2065b)
 set(NGX_TXID_VERSION f1c197cb9c42e364a87fbb28d5508e486592ca42)
 set(NGX_TXID_HASH 408ee86eb6e42e27a51514f711c41d6b)
 set(OPENRESTY_VERSION 1.9.7.4)
@@ -63,8 +63,8 @@
 set(PCRE_HASH 00aabbfe56d5a48b270f999b508c5ad2)
 set(PERP_VERSION 2.07)
 set(PERP_HASH a2acc7425d556d9635a25addcee9edb5)
-set(PRESTO_VERSION 0.144)
-set(PRESTO_HASH bf0bad6556e81473b35b9b2968d57300)
+set(PRESTO_VERSION 0.144.1)
+set(PRESTO_HASH 65c55e15fa69fcbf02afc631842aeb31)
 set(RUBY_VERSION 2.2.4)
 set(RUBY_HASH 31203696adbfdda6f2874a2de31f7c5a1f3bcb6628f4d1a241de21b158cd5c76)
 # Hold at rsyslog 8.14.0 until ElasticSearch issues are fixed (hopefully 8.18):


disable submitting to cdash

disable submitting to cdash

--- test.cmake
+++ test.cmake
@@ -422,7 +422,7 @@
    if(NOT is_experimental)
       CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
       if(res GREATER 0)
-         ctest_submit(PARTS Update)
+         #ctest_submit(PARTS Update)
       endif()
    endif()

@@ -436,7 +436,7 @@
          #"${CTEST_BINARY_DIRECTORY}/CMakeFiles/CMakeOutput.log"
          "${CTEST_BINARY_DIRECTORY}/CMakeFiles/CMakeError.log"
          )
-      ctest_submit(PARTS Notes Configure)
+      #ctest_submit(PARTS Notes Configure)
       unset(CTEST_NOTES_FILES) # less clutter in ctest -V output
       if(res EQUAL 0)
          set(test_results 0)
@@ -446,7 +446,7 @@
                BUILD "${CTEST_BINARY_DIRECTORY}"
                APPEND
                RETURN_VALUE res)
-            ctest_submit(PARTS Build)
+            #ctest_submit(PARTS Build)
             if(NOT skip_tests)
                ctest_test(
                   BUILD "${CTEST_BINARY_DIRECTORY}"
@@ -454,7 +454,7 @@
                   RETURN_VALUE test_results
                   PARALLEL_LEVEL ${number_of_processors})
             endif()
-            ctest_submit(PARTS Test)
+            #ctest_submit(PARTS Test)
          else()
             if("${subset}" STREQUAL "sse")
                set(label_list other Scalar SSE)
@@ -471,7 +471,7 @@
                   BUILD "${CTEST_BINARY_DIRECTORY}"
                   APPEND
                   RETURN_VALUE res)
-               ctest_submit(PARTS Build)
+               #ctest_submit(PARTS Build)
                if(res EQUAL 0 AND NOT skip_tests)
                   execute_process(
                      COMMAND ${CMAKE_CTEST_COMMAND} -N -L "^${label}$"
@@ -487,7 +487,7 @@
                         RETURN_VALUE res
                         PARALLEL_LEVEL ${number_of_processors}
                         INCLUDE_LABEL "^${label}$")
-                     ctest_submit(PARTS Test)
+                     #ctest_submit(PARTS Test)
                      if(NOT res EQUAL 0)
                         message("ctest_test returned non-zero result: ${res}")
                         set(test_results ${res})
@@ -501,7 +501,7 @@
                      BUILD "${CTEST_BINARY_DIRECTORY}"
                      APPEND
                      RETURN_VALUE res)
-                  ctest_submit(PARTS Build)
+                  #ctest_submit(PARTS Build)
                endif()
             endforeach()
          endif()


allow to test compilation for a different target architecture

--- test.cmake
+++ test.cmake
@@ -3,6 +3,8 @@
 endif()

 set(dashboard_model "$ENV{dashboard_model}")
+set(target_architecture "$ENV{target_architecture}")
+set(skip_tests "$ENV{skip_tests}")

 execute_process(COMMAND uname -s OUTPUT_VARIABLE arch OUTPUT_STRIP_TRAILING_WHITESPACE)
 string(TOLOWER "${arch}" arch)
@@ -77,6 +79,11 @@
    set(CMAKE_MAKE_PROGRAM "make")
 endif()

+set(configure_options "-DCTEST_USE_LAUNCHERS=${CTEST_USE_LAUNCHERS};-DCMAKE_BUILD_TYPE=Release;-DBUILD_EXAMPLES=TRUE")
+if(target_architecture)
+   set(configure_options "${configure_options};-DTARGET_ARCHITECTURE=${target_architecture}")
+endif()
+
 macro(go)
    CTEST_START (${dashboard_model})
    set(res 0)
@@ -88,7 +95,7 @@
    endif()
    if(NOT ${dashboard_model} STREQUAL "Continuous" OR res GREATER 0)
       CTEST_CONFIGURE (BUILD "${CTEST_BINARY_DIRECTORY}"
-         OPTIONS "-DCTEST_USE_LAUNCHERS=${CTEST_USE_LAUNCHERS};-DCMAKE_BUILD_TYPE=Release;-DBUILD_EXAMPLES=TRUE"
+         OPTIONS "${configure_options}"
          APPEND
          RETURN_VALUE res)
       ctest_submit(PARTS Notes Configure)
@@ -103,7 +110,7 @@
                APPEND
                RETURN_VALUE res)
             ctest_submit(PARTS Build)
-            if(res EQUAL 0)
+            if(res EQUAL 0 AND NOT skip_tests)
                ctest_test(
                   BUILD "${CTEST_BINARY_DIRECTORY}"
                   APPEND


of course it should submit if it updated >0 files

--- test.cmake
+++ test.cmake
@@ -18,7 +18,7 @@
    set(res 0)
    if(NOT $ENV{ctest_model} STREQUAL "Experimental")
       CTEST_UPDATE (SOURCE "${CTEST_SOURCE_DIRECTORY}" RETURN_VALUE res)
-      if(res EQUAL 0)
+      if(res GREATER 0)
          ctest_submit(PARTS Update Notes)
       endif()
    endif()


CTS-231 WIP update mac and linux autobuild libraries for glod and convex decomp

Updating cmake to ensure that linux uses the non-stub version of convex decomp.

Code reviewed by Falcon

--- indra/cmake/LLConvexDecomposition.cmake
+++ indra/cmake/LLConvexDecomposition.cmake
@@ -5,11 +5,11 @@

 if (INSTALL_PROPRIETARY AND NOT STANDALONE)
   use_prebuilt_binary(llconvexdecomposition)
-  if (WINDOWS)
+  if (WINDOWS OR LINUX)
     set(LLCONVEXDECOMP_LIBRARY llconvexdecomposition)
-  else (WINDOWS)
+  else (WINDOWS OR LINUX)
     set(LLCONVEXDECOMP_LIBRARY llconvexdecompositionstub)
-  endif (WINDOWS)
+  endif (WINDOWS OR LINUX)
 else (INSTALL_PROPRIETARY AND NOT STANDALONE)
   use_prebuilt_binary(llconvexdecompositionstub)
   set(LLCONVEXDECOMP_LIBRARY llconvexdecompositionstub)


Re-Add MSVC specialization

Re-Add MSVC specialization

--- HalideGenerator.cmake
+++ HalideGenerator.cmake
@@ -73,8 +73,11 @@
       "-f" "${args_GENERATED_FUNCTION_NAMESPACE}${args_GENERATED_FUNCTION}"
       "-o" "${SCRATCH_DIR}" ${args_GENERATOR_ARGS}
   )
-
-  if(XCODE)
+  if(MSVC)
+    # In MSVC, the generator executable will be placed in a configuration specific
+    # directory specified by ${CMAKE_CFG_INTDIR}.
+    set(generator_exec "${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${args_GENERATOR_TARGET}${CMAKE_EXECUTABLE_SUFFIX}")
+  elseif(XCODE)
     # In Xcode, the generator executable will be placed in a configuration specific
     # directory, so the Xcode variable $(CONFIGURATION) is passed in the custom build script.
     set(generator_exec "${CMAKE_BINARY_DIR}/bin/$(CONFIGURATION)/${args_GENERATOR_TARGET}${CMAKE_EXECUTABLE_SUFFIX}")


Always build sjpeg as a static library. (#588)

sjpeg is bundled into the tools and not installed. This patch builds
sjpeg as a static library even if libjxl is built as a shared library.

--- third_party/sjpeg.cmake
+++ third_party/sjpeg.cmake
@@ -19,5 +19,9 @@
 # This setting makes it prefer the new version.
 set(OpenGL_GL_PREFERENCE GLVND)

+# Build SJPEG as a static library.
+set(BUILD_SHARED_LIBS_BACKUP ${BUILD_SHARED_LIBS})
+set(BUILD_SHARED_LIBS OFF)
 add_subdirectory(sjpeg EXCLUDE_FROM_ALL)
 target_include_directories(sjpeg PUBLIC "${CMAKE_CURRENT_LIST_DIR}/sjpeg/src/")
+set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_BACKUP})


Update FindAPR-ACCRE

Update FindAPR-ACCRE

--- src/ibp/cmake/FindAPR-ACCRE.cmake
+++ src/ibp/cmake/FindAPR-ACCRE.cmake
@@ -1,52 +1,64 @@
-# -*- cmake -*-
+# Source: http://svn.trolocsis.com/repos/projects/templates/apr/build/FindAPR.cmake
+# Locate APR include paths and libraries

-# - Find Apache Portable Runtime
-# Find the APR includes and libraries
 # This module defines
-#  APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc.
-#  APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR.
-#  APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR.
-# also defined, but not for general use are
-#  APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library.
+# APR_INCLUDES, where to find apr.h, etc.
+# APR_LIBS, linker switches to use with ld to link against APR
+# APR_EXTRALIBS, additional libraries to link against
+# APR_CFLAGS, the flags to use to compile
+# APR_FOUND, set to TRUE if found, FALSE otherwise
+# APR_VERSION, the version of APR that was found

-# APR first.
+set(APR_FOUND FALSE)

-# Find the *relative* include path
-find_path(apr_inc NAMES apr-accre-1.0/apr.h apr-ACCRE-1/apr.h)
+find_program(APR_CONFIG_EXECUTABLE apr-ACCRE-1-config)
+mark_as_advanced(APR_CONFIG_EXECUTABLE)

-# Now convert it to the full path
-if (apr_inc)
-   find_path(APR_INCLUDE_DIR NAMES apr.h PATHS ${apr_inc}/apr-accre-1.0 ${apr_inc}/apr-ACCRE-1 )
-else (apr_inc)
-   find_path(APR_INCLUDE_DIR apr.h)
-endif (apr_inc)
+macro(_apr_invoke _varname _regexp)
+    execute_process(
+        COMMAND ${APR_CONFIG_EXECUTABLE} ${ARGN}
+        OUTPUT_VARIABLE _apr_output
+        RESULT_VARIABLE _apr_failed
+    )

-FIND_LIBRARY(APR_LIBRARY NAMES apr-ACCRE-1)
+    if(_apr_failed)
+        message(FATAL_ERROR "${APR_CONFIG_EXECUTABLE} ${ARGN} failed")
+    else()
+        string(REGEX REPLACE "[\r\n]"  "" _apr_output "${_apr_output}")

-IF (APR_LIBRARY AND APR_INCLUDE_DIR)
-    SET(APR_LIBRARIES ${APR_LIBRARY})
-    SET(APR_FOUND "YES")
-ELSE (APR_LIBRARY AND APR_INCLUDE_DIR)
-  SET(APR_FOUND "NO")
-ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR)
+        if(NOT ${_regexp} STREQUAL "")
+            string(REGEX REPLACE "${_regexp}" " " _apr_output "${_apr_output}")
+        endif()

+        # trim string after processing the _regexp arg because it may introduce a <space> at the ends of the string
+        string(REGEX REPLACE " +$"     "" _apr_output "${_apr_output}")
+        string(REGEX REPLACE "^ +"     "" _apr_output "${_apr_output}")

-IF (APR_FOUND)
-   IF (NOT APR_FIND_QUIETLY)
-      MESSAGE(STATUS "Found APR-ACCRE: ${APR_LIBRARIES}")
-   ENDIF (NOT APR_FIND_QUIETLY)
-ELSE (APR_FOUND)
-   IF (APR_FIND_REQUIRED)
-      MESSAGE(FATAL_ERROR "Could not find APR-ACCRE library")
-   ENDIF (APR_FIND_REQUIRED)
-ENDIF (APR_FOUND)
+        # XXX: We don't want to invoke separate_arguments() for APR_CFLAGS;
+        # just leave as-is
+        if(NOT ${_varname} STREQUAL "APR_CFLAGS")
+            separate_arguments(_apr_output)
+        endif(NOT ${_varname} STREQUAL "APR_CFLAGS")

-# Deprecated declarations.
-SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} )
-GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH)
+        set(${_varname} "${_apr_output}")
+    endif()
+endmacro(_apr_invoke)

-MARK_AS_ADVANCED(
-  APR_LIBRARY
-  APR_INCLUDE_DIR
-  )
+_apr_invoke(APR_CFLAGS    ""        --cppflags --cflags)
+_apr_invoke(APR_INCLUDES  "(^| )-I" --includes)
+_apr_invoke(APR_LIBS      ""        --link-ld)
+_apr_invoke(APR_LIBTOOL   "(^| )-L" --link-libtool)
+_apr_invoke(APR_EXTRALIBS "(^| )-l" --libs)
+_apr_invoke(APR_VERSION   ""        --version)

+list(GET APR_LIBTOOL 0 APR_LIBTOOL_ARG0)
+
+get_filename_component(APR_LIBTOOL_BASE ${APR_LIBTOOL_ARG0} PATH )
+FIND_LIBRARY(APR_LIBRARY NAMES apr-accre-1 apr-ACCRE-1 PATHS ${APR_LIBTOOL_BASE})
+
+# compatibility, allow this CMake module to work with the various CMakeList.txt files
+set(APR_INCLUDE_DIR "${APR_INCLUDES}")
+
+MESSAGE(STATUS "APR AT ${APR_LIBRARY}")
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(APR DEFAULT_MSG APR_INCLUDES APR_LIBRARY APR_LIBS APR_VERSION)


cmake: enable warning as errors

cmake: enable warning as errors

--- cmake/Reaper.cmake
+++ cmake/Reaper.cmake
@@ -49,7 +49,7 @@

 # Helper function that add default compilation flags for reaper targets
 function(reaper_configure_warnings target enabled)
-    set(REAPER_WARNING_AS_ERRORS OFF)
+    set(REAPER_WARNING_AS_ERRORS ON)
     set(REAPER_DEBUG_FLAGS)
     set(REAPER_RELEASE_FLAGS)
     if(${enabled})
@@ -63,12 +63,14 @@
                 list(APPEND REAPER_DEBUG_FLAGS "/WX")
             endif()
         elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+            # NOTE: cotire pch generation outputs false positives for this warning
+            # "-Wmissing-include-dirs"
             list(APPEND REAPER_DEBUG_FLAGS
-                "-Wall" "-Wextra" "-Wundef" "-Wshadow" "-funsigned-char"
-                "-Wchar-subscripts" "-Wcast-align" "-Wwrite-strings" "-Wunused" "-Wuninitialized"
+                "-Wall" "-Wextra" "-Wundef" "-Wunused" "-Wshadow" "-funsigned-char"
+                "-Wchar-subscripts" "-Wcast-align" "-Wwrite-strings" "-Wuninitialized"
                 "-Wpointer-arith" "-Wredundant-decls" "-Winline" "-Wformat"
-                "-Wformat-security" "-Winit-self" "-Wdeprecated-declarations"
-                "-Wmissing-include-dirs" "-Wmissing-declarations")
+                "-Wformat-security" "-Winit-self"
+                "-Wdeprecated-declarations" "-Wmissing-declarations")
             if(REAPER_WARNING_AS_ERRORS)
                 list(APPEND REAPER_DEBUG_FLAGS "-Werror")
             endif()


discard comments in kernels.cpp

discard comments in kernels.cpp

--- cmake/cl2cpp.cmake
+++ cmake/cl2cpp.cmake
@@ -18,6 +18,7 @@
   string(REPLACE "\t" "  " lines "${lines}")

   string(REGEX REPLACE "/\\*([^*]/|\\*[^/]|[^*/])*\\*/" ""   lines "${lines}") # multiline comments
+  string(REGEX REPLACE "/\\*([^\n])*\\*/"               ""   lines "${lines}") # single-line comments
   string(REGEX REPLACE "[ ]*//[^\n]*\n"                 "\n" lines "${lines}") # single-line comments
   string(REGEX REPLACE "\n[ ]*(\n[ ]*)*"                "\n" lines "${lines}") # empty lines & leading whitespace
   string(REGEX REPLACE "^\n"                            ""   lines "${lines}") # leading new line


Workaround crash with dtraced shared libraries under GCC 3.4.6 on 32 bit Solaris.
Crash happens in dlopen() code when trying to load the library. Crash does not happen when library is
not DTrace instrumented . Additionally, crash does not happen with default Solaris 10 GCC 3.4.3 and
it does not happen if main executable is instrumented.

So , just check for this specific situation (32 bit, GCC3.4.6 , Solaris) and disable Dtrace in shared libraries.
We have only single plugin so far that is instrumented (ha_example)

--- cmake/dtrace.cmake
+++ cmake/dtrace.cmake
@@ -72,8 +72,29 @@
   )
 ENDIF()

+IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_COMPILER_IS_GNUCXX
+  AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+  IF(NOT DEFINED BUGGY_GCC_NO_DTRACE_MODULES)
+    EXECUTE_PROCESS(
+      COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}  --version
+      OUTPUT_VARIABLE out)
+    IF(out MATCHES "3.4.6")
+     # This gcc causes crashes in dlopen() for dtraced shared libs,
+     # while standard shipped with Solaris10 3.4.3 is ok
+     SET(BUGGY_GCC_NO_DTRACE_MODULES 1 CACHE INTERNAL "")
+    ELSE()
+     SET(BUGGY_GCC_NO_DTRACE_MODULES 0 CACHE INTERNAL "")
+    ENDIF()
+  ENDIF()
+ENDIF()

-MACRO(DTRACE_INSTRUMENT target)
+FUNCTION(DTRACE_INSTRUMENT target)
+  IF(BUGGY_GCC_NO_DTRACE_MODULES)
+    GET_TARGET_PROPERTY(target_type ${target} TYPE)
+    IF(target_type MATCHES "MODULE_LIBRARY")
+      RETURN()
+    ENDIF()
+  ENDIF()
   IF(ENABLE_DTRACE)
     ADD_DEPENDENCIES(${target} gen_dtrace_header)

@@ -119,7 +140,7 @@
       ENDIF()
     ENDIF()
   ENDIF()
-ENDMACRO()
+ENDFUNCTION()

 # Ugly workaround for Solaris' DTrace inability to use probes


fptu: subtree-pull erthink upstream (fix cmake macro).

Merge commit '1e507372506f2ab30b4949d9aa72b151e95e3be7' into devel

--- fast_positive/erthink/cmake/utils.cmake
+++ fast_positive/erthink/cmake/utils.cmake
@@ -145,8 +145,9 @@
     set(${name}_GIT_REVISION 0)

     # Try to get version from VERSION file
-    if(EXISTS "${version_file}/VERSION")
-      file(STRINGS "${version_file}/VERSION" ${name}_VERSION)
+    set(version_file "${source_root_directory}/VERSION")
+    if(EXISTS "${version_file}")
+      file(STRINGS "${version_file}" ${name}_VERSION LIMIT_COUNT 1 LIMIT_INPUT 42)
     endif()

     if(NOT ${name}_VERSION)


Fix option name after merging

Fix option name after merging

--- build_tools/cmake/iree_cross_compile.cmake
+++ build_tools/cmake/iree_cross_compile.cmake
@@ -76,7 +76,7 @@

   # LINT.IfChange(iree_cross_compile_options)
   iree_to_bool(_CONFIG_ENABLE_RUNTIME_TRACING "${IREE_${config_name}_ENABLE_RUNTIME_TRACING}")
-  iree_to_bool(_CONFIG_ENABLE_LLVM "${IREE_${config_name}_ENABLE_LLVM}")
+  iree_to_bool(_CONFIG_ENABLE_MLIR "${IREE_${config_name}_ENABLE_MLIR}")
   iree_to_bool(_CONFIG_ENABLE_EMITC "${IREE_${config_name}_ENABLE_EMITC}")

   iree_to_bool(_CONFIG_BUILD_COMPILER "${IREE_${config_name}_BUILD_COMPILER}")
@@ -103,7 +103,7 @@
         -DCMAKE_C_COMPILER="${_CONFIG_C_COMPILER}"
         -DCMAKE_CXX_COMPILER="${_CONFIG_CXX_COMPILER}"
         -DIREE_ENABLE_RUNTIME_TRACING=${_CONFIG_ENABLE_RUNTIME_TRACING}
-        -DIREE_ENABLE_LLVM=${_CONFIG_ENABLE_LLVM}
+        -DIREE_ENABLE_MLIR=${_CONFIG_ENABLE_MLIR}
         -DIREE_ENABLE_EMITC=${_CONFIG_ENABLE_EMITC}
         -DIREE_BUILD_COMPILER=${_CONFIG_BUILD_COMPILER}
         -DIREE_BUILD_TESTS=${_CONFIG_BUILD_TESTS}


Fixed issue with _FOUND variable set in EnableUpstreamTarget: Since it's a macro 'PARENT_SCOPE' does the wrong thing.

--- src/cmake/EnableUpstreamTargets.cmake
+++ src/cmake/EnableUpstreamTargets.cmake
@@ -6,10 +6,7 @@
 # Overload add_library to remember all targets manually (checking if target exists is not reliable enough)
 macro(add_library)
     _add_library(${ARGV})
-    # No need to store aliases
-    if(NOT "${ARGV1}" STREQUAL "ALIAS")
-        set_property(GLOBAL APPEND PROPERTY UPSTREAM_TARGETS "${ARGV0}")
-    endif()
+    set_property(GLOBAL APPEND PROPERTY UPSTREAM_TARGETS "${ARGV0}")
 endmacro()

 # Overload find_package to null-op if package is an upstream target (in same build)
@@ -20,6 +17,7 @@
     if(NOT ${target_name} IN_LIST UPSTREAM_TARGETS)
         _find_package(${ARGV})
     else()
-        set("${target_name}_FOUND" TRUE PARENT_SCOPE)
+        string(CONCAT found "${target_name}" "_FOUND")
+        set(${found} TRUE)
     endif()
 endmacro()


build: do not search for native LLVM when not building tools

The standard library does not depend on the LLVM libraries at runtime.  Do not
perform the search for the LLVM configuration when the tools are not being
built.  This is needed to permit cross-compiling the standard library standalone
for android on a Linux host without building LLVM and Clang for android.

--- cmake/modules/SwiftSharedCMakeConfig.cmake
+++ cmake/modules/SwiftSharedCMakeConfig.cmake
@@ -62,32 +62,34 @@
     set(${product}_NATIVE_LLVM_TOOLS_PATH "${LLVM_TOOLS_BINARY_DIR}")
   endif()

-  if(CMAKE_CROSSCOMPILING)
-    set(LLVM_NATIVE_BUILD_DIR "${LLVM_BINARY_DIR}/NATIVE")
-    if(NOT EXISTS "${LLVM_NATIVE_BUILD_DIR}")
-      message(FATAL_ERROR
-        "Attempting to cross-compile swift standalone but no native LLVM build
-        found.  Please cross-compile LLVM as well.")
-    endif()
-
-    if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
-      set(HOST_EXECUTABLE_SUFFIX ".exe")
-    endif()
-
-    if(NOT CMAKE_CONFIGURATION_TYPES)
-      set(LLVM_TABLEGEN_EXE
-        "${LLVM_NATIVE_BUILD_DIR}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+  if(SWIFT_INCLUDE_TOOLS)
+    if(CMAKE_CROSSCOMPILING)
+      set(LLVM_NATIVE_BUILD_DIR "${LLVM_BINARY_DIR}/NATIVE")
+      if(NOT EXISTS "${LLVM_NATIVE_BUILD_DIR}")
+        message(FATAL_ERROR
+          "Attempting to cross-compile swift standalone but no native LLVM build
+          found.  Please cross-compile LLVM as well.")
+      endif()
+
+      if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+        set(HOST_EXECUTABLE_SUFFIX ".exe")
+      endif()
+
+      if(NOT CMAKE_CONFIGURATION_TYPES)
+        set(LLVM_TABLEGEN_EXE
+          "${LLVM_NATIVE_BUILD_DIR}/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+      else()
+        # NOTE: LLVM NATIVE build is always built Release, as is specified in
+        # CrossCompile.cmake
+        set(LLVM_TABLEGEN_EXE
+          "${LLVM_NATIVE_BUILD_DIR}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
+      endif()
     else()
-      # NOTE: LLVM NATIVE build is always built Release, as is specified in
-      # CrossCompile.cmake
-      set(LLVM_TABLEGEN_EXE
-        "${LLVM_NATIVE_BUILD_DIR}/Release/bin/llvm-tblgen${HOST_EXECUTABLE_SUFFIX}")
-    endif()
-  else()
-    find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" HINTS ${LLVM_TOOLS_BINARY_DIR}
-      NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
-    if(LLVM_TABLEGEN_EXE STREQUAL "LLVM_TABLEGEN_EXE-NOTFOUND")
-      message(FATAL_ERROR "Failed to find tablegen in ${LLVM_TOOLS_BINARY_DIR}")
+      find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" HINTS ${LLVM_TOOLS_BINARY_DIR}
+        NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
+      if(LLVM_TABLEGEN_EXE STREQUAL "LLVM_TABLEGEN_EXE-NOTFOUND")
+        message(FATAL_ERROR "Failed to find tablegen in ${LLVM_TOOLS_BINARY_DIR}")
+      endif()
     endif()
   endif()


Remove no-break spaces from build path for Qt moc

The moc from Qt cannot deal with no-break spaces in the path. Drop them.

Signed-off-by: Matthias Kretz <372ea4eca737a13cd010ee806d4ce7b98ee71550@kde.org>

--- test.cmake
+++ test.cmake
@@ -236,7 +236,7 @@

 # Determine build directory
 ################################################################################
-string(REGEX REPLACE "[][ ():,]" "" CTEST_BINARY_DIRECTORY "${CTEST_BUILD_NAME}")
+string(REGEX REPLACE "[][ ():, ]" "" CTEST_BINARY_DIRECTORY "${CTEST_BUILD_NAME}")
 set(CTEST_BINARY_DIRECTORY "${CTEST_SOURCE_DIRECTORY}/build-${dashboard_model}-${CTEST_BINARY_DIRECTORY}")

 # Give user feedback


cmake template

cmake template

--- src/msise00/setup.cmake
+++ src/msise00/setup.cmake
@@ -7,49 +7,12 @@

 # --- boilerplate follows
 message(STATUS "CMake ${CMAKE_VERSION}")
-if(CMAKE_VERSION VERSION_LESS 3.12)
-  message(FATAL_ERROR "Please update CMake >= 3.12.
+if(CMAKE_VERSION VERSION_LESS 3.15)
+  message(FATAL_ERROR "Please update CMake >= 3.15.
     Try 'pip install -U cmake' or https://cmake.org/download/")
 endif()

-# site is OS name
-if(NOT DEFINED CTEST_SITE)
-  set(CTEST_SITE ${CMAKE_SYSTEM_NAME})
-endif()
-
-# parallel test--use ctest_test(PARALLEL_LEVEL ${Ncpu} as setting CTEST_PARALLEL_LEVEL has no effect
-include(ProcessorCount)
-ProcessorCount(Ncpu)
-message(STATUS "${Ncpu} CPU cores detected")
-
-# test name is Fortran compiler in FC
-# Note: ctest scripts cannot read cache variables like CMAKE_Fortran_COMPILER
-if(DEFINED ENV{FC})
-  set(FC $ENV{FC})
-  set(CTEST_BUILD_NAME ${FC})
-
-  if(NOT DEFINED ENV{CC})
-    # use same compiler for C and Fortran, which CMake might not do itself
-    if(FC STREQUAL ifort)
-      if(WIN32)
-        set(ENV{CC} icl)
-      else()
-        set(ENV{CC} icc)
-      endif()
-    endif()
-  endif()
-endif()
-
-if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
-  set(CTEST_BUILD_CONFIGURATION "Release")
-endif()
-
-set(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
-if(NOT DEFINED CTEST_BINARY_DIRECTORY)
-  set(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/build)
-endif()
-
-# CTEST_CMAKE_GENERATOR must be defined in any case here.
+# CTEST_CMAKE_GENERATOR must always be defined
 if(NOT DEFINED CTEST_CMAKE_GENERATOR AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
   find_program(_gen NAMES ninja ninja-build samu)
   if(_gen)
@@ -64,13 +27,31 @@
   endif(_gen)
 endif()
 if(NOT DEFINED CTEST_CMAKE_GENERATOR)
+  set(CTEST_BUILD_FLAGS -j)  # not --parallel as this goes to generator directly
   if(WIN32)
     set(CTEST_CMAKE_GENERATOR "MinGW Makefiles")
-    set(CTEST_BUILD_FLAGS -j)  # not --parallel as this goes to generator directly
   else()
     set(CTEST_CMAKE_GENERATOR "Unix Makefiles")
-    set(CTEST_BUILD_FLAGS -j)  # not --parallel as this goes to generator directly
   endif()
+endif()
+
+# site is OS name
+if(NOT DEFINED CTEST_SITE)
+  set(CTEST_SITE ${CMAKE_SYSTEM_NAME})
+endif()
+
+# parallel test--use ctest_test(PARALLEL_LEVEL ${Ncpu} as setting CTEST_PARALLEL_LEVEL has no effect
+include(ProcessorCount)
+ProcessorCount(Ncpu)
+message(STATUS "${Ncpu} CPU cores detected")
+
+if(NOT DEFINED CTEST_BUILD_CONFIGURATION)
+  set(CTEST_BUILD_CONFIGURATION "Release")
+endif()
+
+set(CTEST_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED CTEST_BINARY_DIRECTORY)
+  set(CTEST_BINARY_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/build)
 endif()

 # -- build and test


Squashed '3rdparty/github/cmake-utils/' changes from 481c3ad..01a03a4

01a03a4 Added a debug statement
0a3e8da Fix ENDFOREACH
f62100c Do add a compile definition if already present

git-subtree-dir: 3rdparty/github/cmake-utils
git-subtree-split: 01a03a4bd1baaa75c76020d4cdf65ad254c63dd2

--- cmake/MyPackageStart.cmake
+++ cmake/MyPackageStart.cmake
@@ -88,9 +88,23 @@
   SET (CMAKE_POSITION_INDEPENDENT_CODE ON)
   if (("${CMAKE_C_COMPILER_ID} x" MATCHES "MSVC") OR MSVC)
     # Loosely based on http://www.hdfgroup.org/ftp/HDF/HDF_Current/src/unpacked/config/cmake/ConfigureChecks.cmake
-    ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)
-    ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
-    ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
+    FOREACH (_definition "WIN32_LEAN_AND_MEAN" "_CRT_SECURE_NO_WARNINGS" "_CRT_NONSTDC_NO_DEPRECATE")
+      LIST (FIND COMPILE_DEFINITIONS ${_definition} _index)
+      IF (${_index} GREATER -1)
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Compile definition ${_definition} already set")
+        ENDIF ()
+      ELSE ()
+        IF (MYPACKAGE_DEBUG)
+          MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Adding compile definition ${_definition}")
+        ENDIF ()
+      ENDIF ()
+      ADD_DEFINITIONS("-D${_definition}")
+    ENDFOREACH ()
+  ELSE ()
+    IF (MYPACKAGE_DEBUG)
+      MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] CMAKE_C_COMPILER_ID does not match MSVC: ${CMAKE_C_COMPILER_ID}")
+    ENDIF ()
   ENDIF ()
   #
   # Prepare output directories


remove debug message

remove debug message

--- cmake/install_macros.cmake
+++ cmake/install_macros.cmake
@@ -90,7 +90,6 @@
   IF(NOT ARG_DESTINATION)
      MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
   ENDIF()
-  MESSAGE("INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION})")
   INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION})
   SET(INSTALL_LOCATION ${ARG_DESTINATION} )
   INSTALL_DEBUG_SYMBOLS("${TARGETS}")


Tweak comments and a cache variable annotation string.

svn path=/trunk/; revision=6928

--- cmake/modules/python.cmake
+++ cmake/modules/python.cmake
@@ -1,6 +1,4 @@
 # cmake/modules/python.cmake
-#
-# Python binding configuration
 #
 # Copyright (C) 2006  Alan W. Irwin
 #
@@ -27,7 +25,7 @@
 if(ENABLE_python AND NOT SWIG_FOUND)
   message(STATUS "WARNING: "
     "swig not found. Disabling python bindings")
-  set(ENABLE_python OFF CACHE BOOL "Enable Pava bindings" FORCE)
+  set(ENABLE_python OFF CACHE BOOL "Enable Python bindings" FORCE)
 endif(ENABLE_python AND NOT SWIG_FOUND)

 if(ENABLE_python)


fixed SSE detection

fixed SSE detection

--- cmake/Modules/AR_CompilerSettings.cmake
+++ cmake/Modules/AR_CompilerSettings.cmake
@@ -1,6 +1,6 @@
 include(TargetArch)
+target_architecture(ARCH)
 find_package(SSE)
-target_architecture(ARCH)

 set(CMAKE_CXX_STANDARD 11)
 # compiler options


OSX: work around for cyclic dependency of find_package(Qt5PrintSupport)

--- cmake/Qt5Widgets_HunterPlugin_5_5.cmake
+++ cmake/Qt5Widgets_HunterPlugin_5_5.cmake
@@ -81,9 +81,19 @@
       "static_qt_plugins.cpp"
   )

-  # Lead to configuration errors (cyclic dependencies)
-  # find_package(Qt5PrintSupport REQUIRED)
-  # _qt_cmake_extra_helpers_add_interface(Qt5::Widgets Qt5::PrintSupport)
+# Cyclic dependency when using find_package(Qt5PrintSupport) as it tries to find
+# Qt5Widgets. As a work-around, we check for the a variable set in
+# FindQt5PrintSupport.cmake.  This is fragile, but allows the client code to
+# link without changes
+  string(COMPARE EQUAL
+      "${Qt5PrintSupport_VERSION_STRING}"
+      ""
+      _find_package_print_support_not_ran
+  )
+  if(_find_package_print_support_not_ran)
+    find_package(Qt5PrintSupport REQUIRED)
+  endif()
+  _qt_cmake_extra_helpers_add_interface(Qt5::Widgets Qt5::PrintSupport)

   # Frameworks
   _qt_cmake_extra_helpers_add_interface(Qt5::Widgets "-framework Carbon")


Little change

Little change

--- cmake/dev/generate_msvc_libraries.cmake
+++ cmake/dev/generate_msvc_libraries.cmake
@@ -33,7 +33,7 @@

 macro(install_msvc_libraries platform)
     install(DIRECTORY ${PROJECT_BINARY_DIR}/eprosima_installer/${platform}/install/lib/
-        DESTINATION lib/${platform}
+        DESTINATION ${LIB_INSTALL_DIR}/${platform}
         COMPONENT libraries_${platform}
         )


Removed line that shouldn't be there

Removed line that shouldn't be there

--- cmake/modules/BuildGoogleBreakpad.cmake
+++ cmake/modules/BuildGoogleBreakpad.cmake
@@ -68,7 +68,6 @@
     CONFIGURE_COMMAND sh <SOURCE_DIR>/configure --prefix=${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR}
     BUILD_BYPRODUCTS ${_byproducts}
     INSTALL_DIR ${BREAKPAD_EXCEPTION_HANDLER_INSTALL_DIR}
-    #INSTALL_COMMAND mkdir -p <INSTALL_DIR>/include/breakpad && cp -fr <SOURCE_DIR>/src <INSTALL_DIR>/include/breakpad && cp -f <BINARY_DIR>/src/libbreakpad.a <BINARY_DIR>/src/client/linux/libbreakpad_client.a <INSTALL_DIR>/lib && cp -f <BINARY_DIR>/src/tools/linux/dump_syms/dump_syms <INSTALL_DIR>/bin
   )

   ExternalProject_Add_Step(


cmake: Make devices use xml_sort target.

Signed-off-by: Tim 'mithro' Ansell <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@mith.ro>

--- common/cmake/devices.cmake
+++ common/cmake/devices.cmake
@@ -279,37 +279,17 @@
   set(DEVICE_UNIQUE_PACK_FILE arch.unique_pack.xml)
   set(DEVICE_MERGED_LINT_FILE arch.merged.lint.html)

-  set(MERGE_XML_XSL ${symbiflow-arch-defs_SOURCE_DIR}/common/xml/xmlsort.xsl)
-
-  get_file_location(MERGE_XML_INPUT ${DEFINE_DEVICE_TYPE_ARCH_XML})
-  append_file_dependency(DEPS ${DEFINE_DEVICE_TYPE_ARCH_XML})
-
   set(MERGE_XML_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DEVICE_MERGED_FILE})
   set(UNIQUE_PACK_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DEVICE_UNIQUE_PACK_FILE})
   set(MERGE_XMLLINT_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${DEVICE_MERGED_LINT_FILE})

-  get_target_property_required(XSLTPROC env XSLTPROC)
-  get_target_property(XSLTPROC_TARGET env XSLTPROC_TARGET)
-  set(ARCH_SCHEMA ${symbiflow-arch-defs_SOURCE_DIR}/common/xml/fpga_architecture.xsd)
-
-  add_custom_command(
-    OUTPUT ${MERGE_XML_OUTPUT}
-    DEPENDS
-      ${MERGE_XML_XSL}
-      ${DEPS}
-      ${XSLTPROC} ${XSLTPROC_TARGET}
-    COMMAND
-      ${CMAKE_COMMAND} -E make_directory
-      ${CMAKE_CURRENT_BINARY_DIR}/${OUT_DEVICE_DIR}
-    COMMAND
-      ${XSLTPROC}
-      --nomkdir
-      --nonet
-      --xinclude
-      --output ${MERGE_XML_OUTPUT} ${MERGE_XML_XSL} ${MERGE_XML_INPUT}
-  )
-
-  add_file_target(FILE ${DEVICE_MERGED_FILE} GENERATED)
+  xml_sort(
+    NAME ${DEFINE_DEVICE_TYPE_ARCH}_${DEFINE_DEVICE_TYPE_DEVICE_TYPE}_arch_merged
+    FILE ${DEFINE_DEVICE_TYPE_ARCH_XML}
+    OUTPUT ${DEVICE_MERGED_FILE}
+    DIR ${OUT_DEVICE_DIR}
+  )
+
   append_file_dependency(SPECIALIZE_CARRYCHAINS_DEPS ${DEVICE_MERGED_FILE})

   get_target_property_required(PYTHON3 env PYTHON3)
@@ -323,23 +303,25 @@
         ${PYTHON3} ${PYTHON3_TARGET}
         ${SPECIALIZE_CARRYCHAINS}
         ${SPECIALIZE_CARRYCHAINS_DEPS}
-        )
+  )
+  add_file_target(FILE ${DEVICE_UNIQUE_PACK_FILE} GENERATED)

   add_custom_target(
     ${DEFINE_DEVICE_TYPE_ARCH}_${DEFINE_DEVICE_TYPE_DEVICE_TYPE}_arch
     DEPENDS ${UNIQUE_PACK_OUTPUT}
   )
-  add_dependencies(all_merged_arch_xmls
-    ${DEFINE_DEVICE_TYPE_ARCH}_${DEFINE_DEVICE_TYPE_DEVICE_TYPE}_arch)
-
+  add_dependencies(
+    all_merged_arch_xmls
+    ${DEFINE_DEVICE_TYPE_ARCH}_${DEFINE_DEVICE_TYPE_DEVICE_TYPE}_arch
+  )
+
+  set(ARCH_SCHEMA ${symbiflow-arch-defs_SOURCE_DIR}/common/xml/fpga_architecture.xsd)
   xml_lint(
     NAME ${DEFINE_DEVICE_TYPE_ARCH}_${DEFINE_DEVICE_TYPE_DEVICE_TYPE}_arch_lint
     FILE ${UNIQUE_PACK_OUTPUT}
     LINT_OUTPUT ${MERGE_XMLLINT_OUTPUT}
     SCHEMA ${ARCH_SCHEMA}
-    )
-
-  add_file_target(FILE ${DEVICE_UNIQUE_PACK_FILE} GENERATED)
+  )

   set_target_properties(
     ${DEFINE_DEVICE_TYPE_DEVICE_TYPE}


Revert "Changed CMake FindSystemdJournal module to reflect the merging of libsystemd and libsystemd-journal"

This reverts commit cfd3415e148302141c5ba26d738a898fae01ffed.

--- cmake/Modules/FindSystemdJournal.cmake
+++ cmake/Modules/FindSystemdJournal.cmake
@@ -16,7 +16,7 @@
   find_package(PkgConfig)

   if (PKG_CONFIG_FOUND)
-    pkg_check_modules(_LIBSYSTEMD_JOURNAL_PC QUIET "libsystemd")
+    pkg_check_modules(_LIBSYSTEMD_JOURNAL_PC QUIET "libsystemd-journal")
     pkg_check_modules(_LIBSYSTEMD_ID128_PC QUIET "libsystemd-id128")
     pkg_check_modules(_LIBSYSTEMD_PC QUIET "libsystemd")
   endif (PKG_CONFIG_FOUND)
@@ -35,7 +35,7 @@
     /usr/local/include
   )

-  find_library (LIBSYSTEMD_JOURNAL_LIBRARIES NAMES systemd systemd-id128
+  find_library (LIBSYSTEMD_JOURNAL_LIBRARIES NAMES systemd-journal systemd-id128
     PATHS
     ${_LIBSYSTEMD_JOURNAL_PC_LIBDIR}
     ${_LIBSYSTEMD_ID128_PC_LIBDIR}


PolysquareCommon: Add support for GTest's compile and link flags

This is required on Windows

--- PolysquareCommon.cmake
+++ PolysquareCommon.cmake
@@ -400,7 +400,8 @@
 set (PSQ_ALL_BINARY_MULTIVAR_ARGS
      ${PSQ_ALL_SOURCES_MULTIVAR_ARGS}
      ${PSQ_ALL_ACCELERATION_MULTIVAR_ARGS}
-     LIBRARIES)
+     LIBRARIES
+     LINK_DIRECTORIES)

 function (psq_add_checks_to_target TARGET)

@@ -886,6 +887,12 @@

     endif ()

+    if (LIBRARY_LINK_DIRECTORIES)
+
+        link_directories ("${LIBRARY_LINK_DIRECTORIES}")
+
+    endif ()
+
     add_library (${LIBRARY_NAME}
                  ${LIBRARY_TYPE}
                  ${LIBRARY_SOURCES})
@@ -927,6 +934,12 @@

     endif ()

+    if (EXECUTABLE_LINK_DIRECTORIES)
+
+        link_directories ("${EXECUTABLE_LINK_DIRECTORIES}")
+
+    endif ()
+
     add_executable (${EXECUTABLE_NAME}
                     ${EXECUTABLE_SOURCES})

@@ -943,7 +956,8 @@
 endfunction ()

 macro (_psq_add_gtest_includes_and_libraries EXTERNAL_INCLUDE_DIRS_VAR
-                                             LIBRARIES_VAR)
+                                             LIBRARIES_VAR
+                                             LINK_DIRECTORIES_VAR)

     list (APPEND ${EXTERNAL_INCLUDE_DIRS_VAR}
           "${GTEST_INCLUDE_DIR}"
@@ -953,6 +967,9 @@
           ${GTEST_LIBRARY}
           ${GMOCK_LIBRARY}
           ${CMAKE_THREAD_LIBS_INIT})
+
+    list (APPEND ${LINK_DIRECTORIES_VAR}
+          ${GTEST_LIBRARY_DIRS})

 endmacro ()

@@ -1005,7 +1022,8 @@
     endif ()

     _psq_add_gtest_includes_and_libraries (TEST_EXTERNAL_INCLUDE_DIRS
-                                           TEST_LIBRARIES)
+                                           TEST_LIBRARIES
+                                           TEST_LINK_DIRECTORIES)

     if (TEST_MAIN_LIBRARY)

@@ -1080,7 +1098,8 @@
     set (MAIN_LIB_EXT_INC_DIRS ${MAIN_LIBRARY_EXTERNAL_INCLUDE_DIRS})

     _psq_add_gtest_includes_and_libraries (MAIN_LIB_EXT_INC_DIRS
-                                           MAIN_LIBRARY_LIBRARIES)
+                                           MAIN_LIBRARY_LIBRARIES
+                                           MAIN_LIBRARY_LINK_DIRECTORIES)

     # Make sure to expand MAIN_LIB_EXT_INC_DIRS for cmake_forward_arguments
     set (MAIN_LIBRARY_EXTERNAL_INCLUDE_DIRS ${MAIN_LIB_EXT_INC_DIRS})
@@ -1128,7 +1147,8 @@
     endif ()

     _psq_add_gtest_includes_and_libraries (MATCHER_EXTERNAL_INCLUDE_DIRS
-                                           MATCHER_LIBRARIES)
+                                           MATCHER_LIBRARIES
+                                           MATCHER_LINK_DIRECTORIES)

     _psq_clear_variable_names_if_false (MATCHER
                                         ${MATCHER_OPTION_ARGS})
@@ -1173,7 +1193,8 @@
     endif ()

     _psq_add_gtest_includes_and_libraries (MOCK_EXTERNAL_INCLUDE_DIRS
-                                           MOCK_LIBRARIES)
+                                           MOCK_LIBRARIES
+                                           MOCK_LINK_DIRECTORIES)

     _psq_clear_variable_names_if_false (MOCK
                                         ${MOCK_OPTION_ARGS})


Boost is not optional anymore

Boost is not optional anymore

--- CMakeExternals/MITK.cmake
+++ CMakeExternals/MITK.cmake
@@ -20,7 +20,6 @@
   option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY})
   option(MITK_USE_DCMTK "Use DCMTK in MITK" ON)
   option(MITK_USE_QT "Use Nokia's Qt library in MITK" ON)
-  option(MITK_USE_Boost "Use the Boost library in MITK" OFF)
   option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF)
   option(MITK_USE_Python "Enable Python wrapping in MITK" OFF)

@@ -52,7 +51,6 @@
     MITK_USE_CTK
     MITK_USE_DCMTK
     MITK_USE_QT
-    MITK_USE_Boost
     MITK_USE_OpenCV
     MITK_USE_Python
    )
@@ -123,12 +121,10 @@
     endif()
   endforeach()

-  if(MITK_USE_Boost)
-    set(MITK_BOOST_ROOT "${BOOST_ROOT}" CACHE PATH "Path to Boost directory")
-    mark_as_advanced(MITK_BOOST_ROOT)
-    if(MITK_BOOST_ROOT)
-      list(APPEND additional_mitk_cmakevars "-DBOOST_ROOT:PATH=${MITK_BOOST_ROOT}")
-    endif()
+  set(MITK_BOOST_ROOT "${BOOST_ROOT}" CACHE PATH "Path to Boost directory")
+  mark_as_advanced(MITK_BOOST_ROOT)
+  if(MITK_BOOST_ROOT)
+    list(APPEND additional_mitk_cmakevars "-DBOOST_ROOT:PATH=${MITK_BOOST_ROOT}")
   endif()

   set(MITK_SOURCE_DIR "" CACHE PATH "MITK source code location. If empty, MITK will be cloned from MITK_GIT_REPOSITORY")


ENH: CI: Changed testing failure from ERROR to WARNING level.

--- CI/main_superbuild.cmake
+++ CI/main_superbuild.cmake
@@ -158,7 +158,7 @@
            )

 if ( NOT _test_rv EQUAL 0 )
-  message( SEND_ERROR "An error occurs during ctest_test.")
+  message( WARNING "Some tests have failed.")
 endif()

 ctest_submit()


Fix bug 297: Incorrect use of Boost_USE_STATIC_LIBS causes boost library search to fail when trying to switch to Boost dynamic libs

--HG--
branch : v1-7
extra : convert_revision : svn%3A8631bf8a-c64b-0410-883c-f3eb003322f7/branches/v1-7%401875

--- CMake/Dependencies.cmake
+++ CMake/Dependencies.cmake
@@ -135,7 +135,11 @@
 find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
 if (NOT Boost_FOUND)
 	# Try again with the other type of libs
-	set(Boost_USE_STATIC_LIBS NOT ${Boost_USE_STATIC_LIBS})
+	if(Boost_USE_STATIC_LIBS)
+		set(Boost_USE_STATIC_LIBS)
+	else()
+		set(Boost_USE_STATIC_LIBS ON)
+	endif()
 	find_package(Boost COMPONENTS ${OGRE_BOOST_COMPONENTS} QUIET)
 endif()
 find_package(Boost QUIET)


iOS: Don't search for X11 if building for iOS.  I'm surprised that this hasn't been found until now.  Apparently most devs have the X11 package installed.

--- CMake/Dependencies.cmake
+++ CMake/Dependencies.cmake
@@ -70,7 +70,7 @@
 macro_log_feature(FREETYPE_FOUND "freetype" "Portable font engine" "http://www.freetype.org" TRUE "" "")

 # Find X11
-if (UNIX)
+if (UNIX AND NOT OGRE_BUILD_PLATFORM_IPHONE)
 	find_package(X11)
 	macro_log_feature(X11_FOUND "X11" "X Window system" "http://www.x.org" TRUE "" "")
 	macro_log_feature(X11_Xt_FOUND "Xt" "X Toolkit" "http://www.x.org" TRUE "" "")


ENH: Bump ExternalData.cmake.

ENH: Bump ExternalData.cmake.

Use the latest version in ITK to avoid conflicts.

Change-Id: I6f2d1a35540a76d8e5836c61916da2a182fe3516

--- CMake/ExternalData.cmake
+++ CMake/ExternalData.cmake
@@ -20,11 +20,11 @@
 #    <outVar>   # Output variable
 #    [args...]  # Input arguments, DATA{} allowed
 #    )
-# It replaces each DATA{} reference argument with the full path of a real
-# data file on disk that will exist after the <target> builds.
+# It replaces each DATA{} reference in an argument with the full path of a
+# real data file on disk that will exist after the <target> builds.
 #
 # The 'ExternalData_Add_Test' function wraps around the CMake add_test()
-# command but supports DATA{} reference arguments:
+# command but supports DATA{} references in its arguments:
 #  ExternalData_Add_Test(
 #    <target>   # Name of data management target
 #    ...        # Arguments of add_test(), DATA{} allowed
@@ -55,7 +55,7 @@
 # Example usage:
 #   include(ExternalData)
 #   set(ExternalData_URL_TEMPLATES "file:///local/%(algo)/%(hash)"
-#                                  "http://data.org/%(algo)/%(hash)"
+#                                  "http://data.org/%(algo)/%(hash)")
 #   ExternalData_Add_Test(MyData
 #     NAME MyTest
 #     COMMAND MyExe DATA{MyInput.png}
@@ -66,18 +66,26 @@
 # the source tree contains a content link such as "MyInput.png.md5" then the
 # "MyData" target creates a real "MyInput.png" in the build tree.
 #
-# The DATA{} syntax can automatically recognize and fetch a file series.  If
-# the source tree contains a group of files or content links named like a
-# series then a DATA{} reference to one member adds rules to fetch all of
-# them.  Although all members of a series are fetched, only the file
-# originally named by the DATA{} argument is substituted for it.  Two
-# variables configure recognition of a series from DATA{<name>}.  First,
-# ExternalData_SERIES_PARSE is a regex of the form "^(...)(...)(...)$" to
-# parse <prefix>, <number>, and <suffix> parts from <name>.  Second,
-# ExternalData_SERIES_MATCH is a regex matching the <number> part of series
-# members named <prefix><number><suffix>.  Note that the <suffix> of a series
-# does not include a hash-algorithm extension.  Both series configuration
-# variables have default values that work well for common cases.
+# The DATA{} syntax can be told to fetch a file series using the form
+# "DATA{<name>,:}", where the ":" is literal.  If the source tree contains a
+# group of files or content links named like a series then a reference to one
+# member adds rules to fetch all of them.  Although all members of a series
+# are fetched, only the file originally named by the DATA{} argument is
+# substituted for it.  The default configuration recognizes file series names
+# ending with "#.ext", "_#.ext", ".#.ext", or "-#.ext" where "#" is a sequence
+# of decimal digits and ".ext" is any single extension.  Configure it with a
+# regex that parses <number> and <suffix> parts from the end of <name>:
+#  ExternalData_SERIES_PARSE = regex of the form (<number>)(<suffix>)$
+# For more complicated cases set:
+#  ExternalData_SERIES_PARSE = regex with at least two () groups
+#  ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any
+#  ExternalData_SERIES_PARSE_NUMBER = <number> regex group number
+#  ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number
+# Configure series number matching with a regex that matches the
+# <number> part of series members named <prefix><number><suffix>:
+#  ExternalData_SERIES_MATCH = regex matching <number> in all series members
+# Note that the <suffix> of a series does not include a hash-algorithm
+# extension.
 #
 # The DATA{} syntax can alternatively match files associated with the named
 # file and contained in the same directory.  Associated files may be specified
@@ -89,6 +97,14 @@
 # will pass MyInput.mha and MyFrames00.png on the command line but ensure
 # that the associated files are present next to them.
 #
+# The DATA{} syntax may reference a directory using a trailing slash and a
+# list of associated files.  The form DATA{<name>/,<opt1>,<opt2>,...} adds
+# rules to fetch any files in the directory that match one of the associated
+# file options.  For example, the argument DATA{MyDataDir/,REGEX:.*} will pass
+# the full path to a MyDataDir directory on the command line and ensure that
+# the directory contains files corresponding to every file or content link in
+# the MyDataDir source directory.
+#
 # The variable ExternalData_LINK_CONTENT may be set to the name of a supported
 # hash algorithm to enable automatic conversion of real data files referenced
 # by the DATA{} syntax into content links.  For each such <file> a content
@@ -111,8 +127,10 @@
 # to directories within a single source distribution (e.g. they come together
 # in one tarball).
 #
-# The variable ExternalData_BINARY_ROOT may be set to the directory to store the
-# fetched data.  If not set, it defaults to ${CMAKE_BINARY_DIR}/ExternalData.
+# The variable ExternalData_BINARY_ROOT may be set to the directory to hold
+# the real data files named by expanded DATA{} references.  The default is
+# CMAKE_BINARY_DIR.  The directory layout will mirror that of content links
+# under ExternalData_SOURCE_ROOT.
 #
 # Variables ExternalData_TIMEOUT_INACTIVITY and ExternalData_TIMEOUT_ABSOLUTE
 # set the download inactivity and absolute timeouts, in seconds.  The defaults
@@ -121,7 +139,7 @@
 # with CMake >= 2.8.5.

 #=============================================================================
-# Copyright 2010-2011 Kitware, Inc.
+# Copyright 2010-2013 Kitware, Inc.
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -154,7 +172,8 @@
 #=============================================================================

 function(ExternalData_add_test target)
-  ExternalData_expand_arguments("${target}" testArgs ${ARGN})
+  # Expand all arguments as a single string to preserve escaped semicolons.
+  ExternalData_expand_arguments("${target}" testArgs "${ARGN}")
   add_test(${testArgs})
 endfunction()

@@ -189,7 +208,7 @@
                                  -DExternalData_ACTION=local
                                  -DExternalData_CONFIG=${config}
                                  -P ${_ExternalData_SELF}
-        DEPENDS "${name}"
+        MAIN_DEPENDENCY "${name}"
         )
       list(APPEND files "${file}")
     endif()
@@ -202,6 +221,7 @@
     list(GET tuple 0 file)
     list(GET tuple 1 name)
     list(GET tuple 2 ext)
+    set(stamp "${ext}-stamp")
     if(NOT DEFINED "_ExternalData_FILE_${file}")
       set("_ExternalData_FILE_${file}" 1)
       add_custom_command(
@@ -211,7 +231,7 @@
         # List the real file as a second output in case it is a broken link.
         # The files must be listed in this order so CMake can hide from the
         # make tool that a symlink target may not be newer than the input.
-        OUTPUT "${file}${ext}" "${file}"
+        OUTPUT "${file}${stamp}" "${file}"
         # Run the data fetch/update script.
         COMMAND ${CMAKE_COMMAND} -Drelative_top=${CMAKE_BINARY_DIR}
                                  -Dfile=${file} -Dname=${name} -Dext=${ext}
@@ -219,9 +239,9 @@
                                  -DExternalData_CONFIG=${config}
                                  -P ${_ExternalData_SELF}
         # Update whenever the object hash changes.
-        DEPENDS "${name}${ext}"
+        MAIN_DEPENDENCY "${name}${ext}"
         )
-      list(APPEND files "${file}${ext}")
+      list(APPEND files "${file}${stamp}")
     endif()
   endforeach()

@@ -231,16 +251,37 @@

 function(ExternalData_expand_arguments target outArgsVar)
   # Replace DATA{} references with real arguments.
-  set(data_regex "^xDATA{([^{}\r\n]*)}$")
+  set(data_regex "DATA{([^;{}\r\n]*)}")
+  set(other_regex "([^D]|D[^A]|DA[^T]|DAT[^A]|DATA[^{])+|.")
   set(outArgs "")
+  # This list expansion un-escapes semicolons in list element values so we
+  # must re-escape them below anywhere a new list expansion will occur.
   foreach(arg IN LISTS ARGN)
     if("x${arg}" MATCHES "${data_regex}")
-      string(REGEX REPLACE "${data_regex}" "\\1" data "x${arg}")
-      _ExternalData_arg("${target}" "${arg}" "${data}" file)
-      list(APPEND outArgs "${file}")
+      # Re-escape in-value semicolons before expansion in foreach below.
+      string(REPLACE ";" "\\;" tmp "${arg}")
+      # Split argument into DATA{}-pieces and other pieces.
+      string(REGEX MATCHALL "${data_regex}|${other_regex}" pieces "${tmp}")
+      # Compose output argument with DATA{}-pieces replaced.
+      set(outArg "")
+      foreach(piece IN LISTS pieces)
+        if("x${piece}" MATCHES "^x${data_regex}$")
+          # Replace this DATA{}-piece with a file path.
+          string(REGEX REPLACE "${data_regex}" "\\1" data "${piece}")
+          _ExternalData_arg("${target}" "${piece}" "${data}" file)
+          set(outArg "${outArg}${file}")
+        else()
+          # No replacement needed for this piece.
+          set(outArg "${outArg}${piece}")
+        endif()
+      endforeach()
     else()
-      list(APPEND outArgs "${arg}")
-    endif()
+      # No replacements needed in this argument.
+      set(outArg "${arg}")
+    endif()
+    # Re-escape in-value semicolons in resulting list.
+    string(REPLACE ";" "\\;" outArg "${outArg}")
+    list(APPEND outArgs "${outArg}")
   endforeach()
   set("${outArgsVar}" "${outArgs}" PARENT_SCOPE)
 endfunction()
@@ -248,18 +289,19 @@
 #-----------------------------------------------------------------------------
 # Private helper interface

+set(_ExternalData_REGEX_ALGO "MD5")
+set(_ExternalData_REGEX_EXT "md5")
 set(_ExternalData_SELF "${CMAKE_CURRENT_LIST_FILE}")
 get_filename_component(_ExternalData_SELF_DIR "${_ExternalData_SELF}" PATH)

 function(_ExternalData_compute_hash var_hash algo file)
-  if("${algo}" STREQUAL "MD5")
-    # TODO: Errors
+  if("${algo}" MATCHES "^${_ExternalData_REGEX_ALGO}$")
+    # TODO: Require CMake 2.8.7 to support other hashes with file(${algo} ...)
     execute_process(COMMAND "${CMAKE_COMMAND}" -E md5sum "${file}"
       OUTPUT_VARIABLE output)
     string(SUBSTRING "${output}" 0 32 hash)
     set("${var_hash}" "${hash}" PARENT_SCOPE)
   else()
-    # TODO: Other hashes.
     message(FATAL_ERROR "Hash algorithm ${algo} unimplemented.")
   endif()
 endfunction()
@@ -288,7 +330,7 @@
 endfunction()

 function(_ExternalData_link_content name var_ext)
-  if("${ExternalData_LINK_CONTENT}" MATCHES "^(MD5)$")
+  if("${ExternalData_LINK_CONTENT}" MATCHES "^(${_ExternalData_REGEX_ALGO})$")
     set(algo "${ExternalData_LINK_CONTENT}")
   else()
     message(FATAL_ERROR
@@ -298,7 +340,7 @@
   _ExternalData_compute_hash(hash "${algo}" "${name}")
   get_filename_component(dir "${name}" PATH)
   set(staged "${dir}/.ExternalData_${algo}_${hash}")
-  set(ext ".md5")
+  string(TOLOWER ".${algo}" ext)
   _ExternalData_atomic_write("${name}${ext}" "${hash}\n")
   file(RENAME "${name}" "${staged}")
   set("${var_ext}" "${ext}" PARENT_SCOPE)
@@ -313,13 +355,20 @@
   list(GET options 0 data)
   list(REMOVE_AT options 0)

+  # Interpret trailing slashes as directories.
+  set(data_is_directory 0)
+  if("x${data}" MATCHES "^x(.*)([/\\])$")
+    set(data_is_directory 1)
+    set(data "${CMAKE_MATCH_1}")
+  endif()
+
   # Convert to full path.
   if(IS_ABSOLUTE "${data}")
     set(absdata "${data}")
   else()
-    # TODO: If ${data} does not start in "./" or "../" then use search path?
-    get_filename_component(absdata "${CMAKE_CURRENT_SOURCE_DIR}/${data}" ABSOLUTE)
-  endif()
+    set(absdata "${CMAKE_CURRENT_SOURCE_DIR}/${data}")
+  endif()
+  get_filename_component(absdata "${absdata}" ABSOLUTE)

   # Convert to relative path under the source tree.
   if(NOT ExternalData_SOURCE_ROOT)
@@ -333,16 +382,33 @@
       "does not lie under the top-level source directory\n"
       "  ${top_src}\n")
   endif()
+  if(data_is_directory AND NOT IS_DIRECTORY "${top_src}/${reldata}")
+    message(FATAL_ERROR "Data directory referenced by argument\n"
+      "  ${arg}\n"
+      "corresponds to source tree path\n"
+      "  ${reldata}\n"
+      "that does not exist as a directory!")
+  endif()
   if(NOT ExternalData_BINARY_ROOT)
-    set(ExternalData_BINARY_ROOT "${CMAKE_BINARY_DIR}/ExternalData")
+    set(ExternalData_BINARY_ROOT "${CMAKE_BINARY_DIR}")
   endif()
   set(top_bin "${ExternalData_BINARY_ROOT}")
+
+  # Handle in-source builds gracefully.
+  if("${top_src}" STREQUAL "${top_bin}")
+    if(ExternalData_LINK_CONTENT)
+      message(WARNING "ExternalData_LINK_CONTENT cannot be used in-source")
+      set(ExternalData_LINK_CONTENT 0)
+    endif()
+    set(top_same 1)
+  endif()

   set(external "") # Entries external to the source tree.
   set(internal "") # Entries internal to the source tree.
-  set(have_original 0)
+  set(have_original ${data_is_directory})

   # Process options.
+  set(series_option "")
   set(associated_files "")
   set(associated_regex "")
   foreach(opt ${options})
@@ -350,6 +416,9 @@
       # Regular expression to match associated files.
       string(REGEX REPLACE "^REGEX:" "" regex "${opt}")
       list(APPEND associated_regex "${regex}")
+    elseif("x${opt}" MATCHES "^x:$")
+      # Activate series matching.
+      set(series_option "${opt}")
     elseif("x${opt}" MATCHES "^[^][:/*?]+$")
       # Specific associated file.
       list(APPEND associated_files "${opt}")
@@ -359,16 +428,31 @@
     endif()
   endforeach()

-  if(associated_files OR associated_regex)
-    # Load the named data file and listed/matching associated files.
+  if(series_option)
+    if(data_is_directory)
+      message(FATAL_ERROR "Series option \"${series_option}\" not allowed with directories.")
+    endif()
+    if(associated_files OR associated_regex)
+      message(FATAL_ERROR "Series option \"${series_option}\" not allowed with associated files.")
+    endif()
+    # Load a whole file series.
+    _ExternalData_arg_series()
+  elseif(data_is_directory)
+    if(associated_files OR associated_regex)
+      # Load listed/matching associated files in the directory.
+      _ExternalData_arg_associated()
+    else()
+      message(FATAL_ERROR "Data directory referenced by argument\n"
+        "  ${arg}\n"
+        "must list associated files.")
+    endif()
+  else()
+    # Load the named data file.
     _ExternalData_arg_single()
-    _ExternalData_arg_associated()
-  elseif("${reldata}" MATCHES "(^|/)[^/.]+$")
-    # Files with no extension cannot be a series.
-    _ExternalData_arg_single()
-  else()
-    # Match a whole file series by default.
-    _ExternalData_arg_series()
+    if(associated_files OR associated_regex)
+      # Load listed/matching associated files.
+      _ExternalData_arg_associated()
+    endif()
   endif()

   if(NOT have_original)
@@ -376,7 +460,7 @@
       "  ${arg}\n"
       "corresponds to source tree path\n"
       "  ${reldata}\n"
-      "that does not exist (with or without an extension)!")
+      "that does not exist as a file (with or without an extension)!")
   endif()

   if(external)
@@ -394,7 +478,11 @@

 macro(_ExternalData_arg_associated)
   # Associated files lie in the same directory.
-  get_filename_component(reldir "${reldata}" PATH)
+  if(data_is_directory)
+    set(reldir "${reldata}")
+  else()
+    get_filename_component(reldir "${reldata}" PATH)
+  endif()
   if(reldir)
     set(reldir "${reldir}/")
   endif()
@@ -424,27 +512,40 @@

 macro(_ExternalData_arg_series)
   # Configure series parsing and matching.
+  set(series_parse_prefix "")
+  set(series_parse_number "\\1")
+  set(series_parse_suffix "\\2")
   if(ExternalData_SERIES_PARSE)
-    if(NOT "${ExternalData_SERIES_PARSE}" MATCHES
-        "^\\^\\([^()]*\\)\\([^()]*\\)\\([^()]*\\)\\$$")
+    if(ExternalData_SERIES_PARSE_NUMBER AND ExternalData_SERIES_PARSE_SUFFIX)
+      if(ExternalData_SERIES_PARSE_PREFIX)
+        set(series_parse_prefix "\\${ExternalData_SERIES_PARSE_PREFIX}")
+      endif()
+      set(series_parse_number "\\${ExternalData_SERIES_PARSE_NUMBER}")
+      set(series_parse_suffix "\\${ExternalData_SERIES_PARSE_SUFFIX}")
+    elseif(NOT "x${ExternalData_SERIES_PARSE}" MATCHES "^x\\([^()]*\\)\\([^()]*\\)\\$$")
       message(FATAL_ERROR
         "ExternalData_SERIES_PARSE is set to\n"
         "  ${ExternalData_SERIES_PARSE}\n"
         "which is not of the form\n"
-        "  ^(...)(...)(...)$\n")
+        "  (<number>)(<suffix>)$\n"
+        "Fix the regular expression or set variables\n"
+        "  ExternalData_SERIES_PARSE_PREFIX = <prefix> regex group number, if any\n"
+        "  ExternalData_SERIES_PARSE_NUMBER = <number> regex group number\n"
+        "  ExternalData_SERIES_PARSE_SUFFIX = <suffix> regex group number\n"
+        )
     endif()
     set(series_parse "${ExternalData_SERIES_PARSE}")
   else()
-    set(series_parse "^(.*)()(\\.[^./]*)$")
+    set(series_parse "([0-9]*)(\\.[^./]*)$")
   endif()
   if(ExternalData_SERIES_MATCH)
     set(series_match "${ExternalData_SERIES_MATCH}")
   else()
-    set(series_match "[_.]?[0-9]*")
+    set(series_match "[_.-]?[0-9]*")
   endif()

   # Parse the base, number, and extension components of the series.
-  string(REGEX REPLACE "${series_parse}" "\\1;\\2;\\3" tuple "${reldata}")
+  string(REGEX REPLACE "${series_parse}" "${series_parse_prefix};${series_parse_number};${series_parse_suffix}" tuple "${reldata}")
   list(LENGTH tuple len)
   if(NOT "${len}" EQUAL 3)
     message(FATAL_ERROR "Data file referenced by argument\n"
@@ -458,7 +559,7 @@
   list(GET tuple 2 ext)

   # Glob files that might match the series.
-  # Then match match base, number, and extension.
+  # Then match base, number, and extension.
   _ExternalData_exact_regex(series_base "${relbase}")
   _ExternalData_exact_regex(series_ext "${ext}")
   _ExternalData_arg_find_files("${relbase}*${ext}"
@@ -468,11 +569,17 @@
 function(_ExternalData_arg_find_files pattern regex)
   file(GLOB globbed RELATIVE "${top_src}" "${top_src}/${pattern}*")
   foreach(entry IN LISTS globbed)
-    string(REGEX REPLACE "^(${regex})(\\.md5|)$" "\\1;\\2" tuple "${entry}")
-    list(LENGTH tuple len)
-    if("${len}" EQUAL 2)
-      list(GET tuple 0 relname)
-      list(GET tuple 1 alg)
+    if("x${entry}" MATCHES "^x(.*)(\\.(${_ExternalData_REGEX_EXT}))$")
+      set(relname "${CMAKE_MATCH_1}")
+      set(alg "${CMAKE_MATCH_2}")
+    else()
+      set(relname "${entry}")
+      set(alg "")
+    endif()
+    if("x${relname}" MATCHES "^x${regex}$" # matches
+        AND NOT IS_DIRECTORY "${top_src}/${entry}" # not a directory
+        AND NOT "x${relname}" MATCHES "(^x|/)\\.ExternalData_" # not staged obj
+        )
       set(name "${top_src}/${relname}")
       set(file "${top_bin}/${relname}")
       if(alg)
@@ -480,7 +587,7 @@
       elseif(ExternalData_LINK_CONTENT)
         _ExternalData_link_content("${name}" alg)
         list(APPEND external "${file}|${name}|${alg}")
-      else()
+      elseif(NOT top_same)
         list(APPEND internal "${file}|${name}")
       endif()
       if("${relname}" STREQUAL "${reldata}")
@@ -652,8 +759,8 @@
   file(READ "${name}${ext}" hash)
   string(STRIP "${hash}" hash)

-  if("${ext}" STREQUAL ".md5")
-    set(algo "MD5")
+  if("${ext}" MATCHES "^\\.(${_ExternalData_REGEX_EXT})$")
+    string(TOUPPER "${CMAKE_MATCH_1}" algo)
   else()
     message(FATAL_ERROR "Unknown hash algorithm extension \"${ext}\"")
   endif()
@@ -661,9 +768,10 @@
   _ExternalData_download_object("${name}" "${hash}" "${algo}" obj)

   # Check if file already corresponds to the object.
+  set(stamp "${ext}-stamp")
   set(file_up_to_date 0)
-  if(EXISTS "${file}" AND EXISTS "${file}${ext}")
-    file(READ "${file}${ext}" f_hash)
+  if(EXISTS "${file}" AND EXISTS "${file}${stamp}")
+    file(READ "${file}${stamp}" f_hash)
     string(STRIP "${f_hash}" f_hash)
     if("${f_hash}" STREQUAL "${hash}")
       #message(STATUS "File already corresponds to object")
@@ -679,7 +787,7 @@
   endif()

   # Atomically update the hash/timestamp file to record the object referenced.
-  _ExternalData_atomic_write("${file}${ext}" "${hash}\n")
+  _ExternalData_atomic_write("${file}${stamp}" "${hash}\n")
 elseif("${ExternalData_ACTION}" STREQUAL "local")
   foreach(v file name)
     if(NOT DEFINED "${v}")
@@ -687,16 +795,6 @@
     endif()
   endforeach()
   _ExternalData_link_or_copy("${name}" "${file}")
-elseif("${ExternalData_ACTION}" STREQUAL "store")
-  foreach(v dir file)
-    if(NOT DEFINED "${v}")
-      message(FATAL_ERROR "No \"-D${v}=\" value provided!")
-    endif()
-  endforeach()
-  if(NOT DEFINED algo)
-    set(algo "MD5")
-  endif()
-  _ExternalData_compute_hash(hash "${algo}" "${file}")
 else()
   message(FATAL_ERROR "Unknown ExternalData_ACTION=[${ExternalData_ACTION}]")
 endif()


Don't declare ostream operators for 64 bit types

--- CMakeExternals/VTK.cmake
+++ CMakeExternals/VTK.cmake
@@ -25,6 +25,14 @@
         -DCMAKE_USE_WIN32_THREADS:BOOL=ON
         -DCMAKE_USE_PTHREADS:BOOL=OFF
         -DVTK_USE_VIDEO4WINDOWS:BOOL=OFF # no header files provided by MinGW
+        )
+  endif()
+
+  if(WIN32)
+    # see http://bugs.mitk.org/show_bug.cgi?id=17858
+    list(APPEND additional_cmake_args
+         -DVTK_DO_NOT_DEFINE_OSTREAM_SLL:BOOL=ON
+         -DVTK_DO_NOT_DEFINE_OSTREAM_ULL:BOOL=ON
         )
   endif()


Add ARPACK_DIR

Add ARPACK_DIR

git-svn-id: fbbf69ba8011aca0e74e1c67904b11cccbdbe66b@27424 0785d39b-7218-0410-832d-ea1e28bc413d

--- deal.II/cmake/modules/FindARPACK.cmake
+++ deal.II/cmake/modules/FindARPACK.cmake
@@ -23,6 +23,8 @@

 INCLUDE(FindPackageHandleStandardArgs)

+SET_IF_EMPTY(ARPACK_DIR "$ENV{ARPACK_DIR}")
+
 #
 # ARPACK needs LAPACK and BLAS as dependency, search for them with the help
 # of the LAPACK find module:
@@ -33,6 +35,8 @@

 FIND_LIBRARY(ARPACK_LIBRARY
   NAMES arpack
+  HINTS
+    ${ARPACK_DIR}
   PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib
   )

@@ -56,6 +60,11 @@
     atlas_LIBRARY
     blas_LIBRARY
     ARPACK_LIBRARY
+    ARPACK_DIR
   )
+ELSE()
+  SET(ARPACK_DIR "" CACHE STRING
+    "An optional hint to an ARPACK installation"
+    )
 ENDIF()


Update comment

Update comment

--- plugin.cmake
+++ plugin.cmake
@@ -39,8 +39,8 @@
 # This form will be used once EXTERNAL_DATA works for data.kitware.com
 #
 # add_python_test(color_normalization PLUGIN HistomicsTK EXTERNAL_DATA
-#   "plugins/histomicstk/L1.png"
-#   "plugins/histomicstk/Easy1.png"
+#   "plugins/histomicstk/L1.png"    # put L1.png.sha512 in plugin_tests/data
+#   "plugins/histomicstk/Easy1.png" # put Easy1.png.sha512 in plugin_tests/data
 #)

 # front-end tests


Beautify log

Beautify log

[skip ci]

--- cmake/modules/hunter_save_to_cache.cmake
+++ cmake/modules/hunter_save_to_cache.cmake
@@ -31,7 +31,7 @@
   if(has_component)
     set(
         human_readable
-        "${human_readable} (component: ${HUNTER_PACKAGE_COMPONENT}"
+        "${human_readable} (component: ${HUNTER_PACKAGE_COMPONENT})"
     )
   endif()
   hunter_status_debug("Saving to cache: ${human_readable}")


Improved MediaSDK detection mechanism

Improved MediaSDK detection mechanism

--- modules/videoio/cmake/detect_msdk.cmake
+++ modules/videoio/cmake/detect_msdk.cmake
@@ -14,9 +14,9 @@
   endif()
   find_path(MFX_INCLUDE mfxdefs.h
     PATHS ${paths}
-    PATH_SUFFIXES "include"
+    PATH_SUFFIXES "include" "include/mfx"
     NO_DEFAULT_PATH)
-  find_library(MFX_LIBRARY mfx libmfx${vs_suffix}
+  find_library(MFX_LIBRARY NAMES mfx libmfx${vs_suffix}
     PATHS ${paths}
     PATH_SUFFIXES "lib64" "lib/lin_x64" "lib/${vs_arch}"
     NO_DEFAULT_PATH)
@@ -28,16 +28,24 @@
 endif()

 if(HAVE_MFX AND UNIX)
-  find_path(MFX_va_INCLUDE va/va.h PATHS ${paths} PATH_SUFFIXES "include")
-  find_library(MFX_va_LIBRARY va PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64")
-  find_library(MFX_va_drm_LIBRARY va-drm PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64")
-  if(MFX_va_INCLUDE AND MFX_va_LIBRARY AND MFX_va_drm_LIBRARY)
-    list(APPEND MFX_INCLUDE_DIRS "${MFX_va_INCLUDE}")
-    list(APPEND MFX_LIBRARIES "${MFX_va_LIBRARY}" "${MFX_va_drm_LIBRARY}")
-    # list(APPEND MFX_LIBRARIES "-Wl,--exclude-libs=libmfx")
-  else()
+  foreach(mode NO_DEFAULT_PATH "")
+    find_path(MFX_va_INCLUDE va/va.h PATHS ${paths} PATH_SUFFIXES "include" ${mode})
+    find_library(MFX_va_LIBRARY va PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64" ${mode})
+    find_library(MFX_va_drm_LIBRARY va-drm PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64" ${mode})
+    if(MFX_va_INCLUDE AND MFX_va_LIBRARY AND MFX_va_drm_LIBRARY)
+      list(APPEND MFX_INCLUDE_DIRS "${MFX_va_INCLUDE}")
+      list(APPEND MFX_LIBRARIES "${MFX_va_LIBRARY}" "${MFX_va_drm_LIBRARY}")
+      # list(APPEND MFX_LIBRARIES "-Wl,--exclude-libs=libmfx")
+      break()
+    endif()
+    unset(MFX_va_INCLUDE CACHE)
+    unset(MFX_va_LIBRARY CACHE)
+    unset(MFX_va_drm_LIBRARY CACHE)
+  endforeach()
+  if(NOT(MFX_va_INCLUDE AND MFX_va_LIBRARY AND MFX_va_drm_LIBRARY))
     set(HAVE_MFX FALSE)
   endif()
+
 endif()

 if(HAVE_MFX)


On Linux now use the default system python instead of defaulting to python2.5. This was a holdover from when on linden systems 2.5 was newer than the default, instead of older.

--- indra/cmake/Python.cmake
+++ indra/cmake/Python.cmake
@@ -23,7 +23,7 @@
 elseif (EXISTS /etc/debian_version)
   # On Debian and Ubuntu, avoid Python 2.4 if possible.

-  find_program(PYTHON_EXECUTABLE python2.5 python2.3 python PATHS /usr/bin)
+  find_program(PYTHON_EXECUTABLE python PATHS /usr/bin)

   if (PYTHON_EXECUTABLE)
     set(PYTHONINTERP_FOUND ON)


FindSQLITE3 Windows fix

FindSQLITE3 Windows fix

--- Modules/FindSQLITE3.cmake
+++ Modules/FindSQLITE3.cmake
@@ -24,15 +24,15 @@

 endif( NOT WIN32 )

-#FIND_PATH(SQLITE3_INCLUDE_DIR NAMES sqlite3.h
-#  PATHS
-#  ${_SQLITE3IncDir}
-#)
+FIND_PATH(SQLITE3_INCLUDE_DIR NAMES sqlite3.h
+  PATHS
+  ${_SQLITE3IncDir}
+)

-#FIND_LIBRARY(SQLITE3_LIBRARIES NAMES sqlite3
-#  PATHS
-#  ${_SQLITE3LinkDir}
-#)
+FIND_LIBRARY(SQLITE3_LIBRARIES NAMES sqlite3
+  PATHS
+  ${_SQLITE3LinkDir}
+)

 #include(FindPackageHandleStandardArgs)
 #FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_INCLUDE_DIR SQLITE3_LIBRARIES )


There is a really bad hack required to get location of Ada support files when
they are not part of CMake itself.  Put FIXME comment there so that users
will have a chance to modify this hack if they choose to change the location
of the Ada support files.

svn path=/trunk/; revision=8425

--- cmake/modules/CMakeTestAdaCompiler.cmake
+++ cmake/modules/CMakeTestAdaCompiler.cmake
@@ -17,6 +17,8 @@

   FILE(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CMakeLists.txt
   "
+# FIXME: This specific location currently needs to be changed whenever the
+# location of the experimental Ada support files is changed.
 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
 set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL \"\" FORCE)
 project(test Ada)