Removed debug noise from tools cmake file.

--- tools/component_definitions.cmake
+++ tools/component_definitions.cmake
@@ -240,7 +240,6 @@
             # and store the result in parent_classpath.
             string(REGEX REPLACE ";" ":" parent_classpath "${FIELDS_CLASSPATH}")
             string(REGEX REPLACE ";" ":" this_classpath "${${COMPONENT}_CLASSPATH}")
-            message(STATUS "${this_classpath}")
             # The default list item separator in cmake is ";". If Linux, then exchange ";" for  the UNIX style ":"
             # and store the result in parent_classpath.
             string(REGEX REPLACE ";" ":" parent_classpath "${${COMPONENT}_CLASSPATH}")
@@ -269,7 +268,6 @@

          # Build the SheafScope jar
         if(WIN64INTEL OR WIN64MSVC)
-          message(STATUS "${this_classpath}")
              add_custom_target(SheafScope.jar ALL
                                  DEPENDS ${PROJECT_NAME}_java_binding.jar
                                  COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_JAR_DIR}
@@ -289,7 +287,6 @@
                                  COMMAND ${JAR_EXECUTABLE} cvmf ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/SheafScope/manifest.txt ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/SheafScope.jar  -C ${LIB_JAR_DIR} .
                               )
         else()
-                  message(STATUS "${this_classpath}")
          # Build the SheafScope jar
              add_custom_target(SheafScope.jar ALL
                                  DEPENDS ${PROJECT_NAME}_java_binding.jar


Add support for using clang on Linux

Add support for using clang on Linux

--- build/cmake/CondorConfigure.cmake
+++ build/cmake/CondorConfigure.cmake
@@ -434,7 +434,7 @@

 		# Some versions of Clang require an additional C++11 flag, as the default stdlib
 		# is from an old GCC version.
-		if ( ${OS_NAME} STREQUAL "DARWIN" AND "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
+		if ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
 			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
 		endif()


Fix STRERROR_R_CHAR_P cxx check (remove unused variable warning->error)
Client: cpp
Patch: Anton Filippov

This closes #2081

--- build/cmake/ConfigureChecks.cmake
+++ build/cmake/ConfigureChecks.cmake
@@ -64,7 +64,7 @@
 check_cxx_source_compiles(
   "
   #include <string.h>
-  int main(){char b;char *a = strerror_r(0, &b, 0); return(0);}
+  int main(){char b;char *a = strerror_r(0, &b, 0); static_cast<void>(a); return(0);}
   "
   STRERROR_R_CHAR_P)


Add opencv_matlab to Python ignored modules

Requested by @vpisarev in #3047.

--- modules/python/common.cmake
+++ modules/python/common.cmake
@@ -15,6 +15,7 @@
 # module blacklist
 ocv_list_filterout(candidate_deps "^opencv_cud(a|ev)")
 ocv_list_filterout(candidate_deps "^opencv_adas$")
+ocv_list_filterout(candidate_deps "^opencv_matlab$")
 ocv_list_filterout(candidate_deps "^opencv_tracking$")


SVN_SILENT made messages (.desktop file)

--- xine/xine.desktop.cmake
+++ xine/xine.desktop.cmake
@@ -67,7 +67,7 @@
 Comment[ca@valencia]=Dorsal del Xine pel Phonon
 Comment[cs]=Phonon Xine backend
 Comment[da]=Xine-backend til Phonon
-Comment[de]=Phonon-Back-End für Xine
+Comment[de]=Phonon-Treiber für Xine
 Comment[el]=Σύστημα υποστήριξης του Phonon Xine
 Comment[en_GB]=Phonon Xine backend
 Comment[es]=Motor Xine para Phonon


COMP: cleaning include directory inherited from ITK

--- otbIncludeDirectories.cmake
+++ otbIncludeDirectories.cmake
@@ -66,7 +66,6 @@
   ${OTB_SOURCE_DIR}/Utilities/otbedison/edge
   ${OTB_SOURCE_DIR}/Utilities/otbsiftfast
   ${OTB_BINARY_DIR}/Code/Visualization
-
 )

 IF(NOT OTB_USE_EXTERNAL_BOOST)
@@ -119,15 +118,35 @@
 	IF(NOT ITK_INSTALL_INCLUDE_DIR)
   		SET(ITK_INSTALL_INCLUDE_DIR "/include/otb/Utilities/ITK")
 	ENDIF(NOT ITK_INSTALL_INCLUDE_DIR)
-        INCLUDE(${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/itkThirdParty.cmake)
- 	INCLUDE(${OTB_SOURCE_DIR}/Utilities/ITK/itkIncludeDirectories.cmake)
+#         INCLUDE(${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/itkThirdParty.cmake)
+#  	INCLUDE(${OTB_SOURCE_DIR}/Utilities/ITK/itkIncludeDirectories.cmake)
 	SET(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE}
 # 2008/12/18: Added ITK include dir
-        ${ITK_INCLUDE_DIRS_BUILD_TREE}
-        ${ITK_INCLUDE_DIRS_BUILD_TREE_CXX}
-        ${ITK_INCLUDE_DIRS_SYSTEM}
-	${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib
-	${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib/opt)
+#         ${ITK_INCLUDE_DIRS_BUILD_TREE}
+#         ${ITK_INCLUDE_DIRS_BUILD_TREE_CXX}
+#         ${ITK_INCLUDE_DIRS_SYSTEM}
+# 	${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib
+# 	${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib/opt
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Algorithms
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/BasicFilters
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Common
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/IO
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Numerics
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Numerics/FEM
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Numerics/NeuralNetworks
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Numerics/Statistics
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Patented
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/Review
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Code/SpatialObject
+        ${OTB_BINARY_DIR}/Utilities/ITK
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/vcl
+        ${OTB_SOURCE_DIR}/Utilities/ITK/Utilities/vxl/core
+        ${OTB_BINARY_DIR}/Utilities/ITK/Utilities/vxl/v3p/netlib
+        ${OTB_BINARY_DIR}/Utilities/ITK/Utilities/vxl/vcl
+        ${OTB_BINARY_DIR}/Utilities/ITK/Utilities/vxl/core
+        ${OTB_BINARY_DIR}/Utilities/ITK/Utilities
+        )
 ENDIF(OTB_USE_EXTERNAL_ITK)

 #For FLTK header file


cmake: Fixed uninstall rule not removing symlinks

--- .cmake/Modules/uninstall.cmake
+++ .cmake/Modules/uninstall.cmake
@@ -1,23 +1,19 @@
 set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")

 if(NOT EXISTS ${MANIFEST})
-message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'")
+  message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'")
 endif()

 file(STRINGS ${MANIFEST} files)
 foreach(file ${files})
-if(EXISTS ${file})
-message(STATUS "Removing file: '${file}'")
-
-exec_program(
-${CMAKE_COMMAND} ARGS "-E remove ${file}"
-OUTPUT_VARIABLE stdout
-RETURN_VALUE result
-)
-if(NOT "${result}" STREQUAL 0)
-message(FATAL_ERROR "Failed to remove file: '${file}'.")
-endif()
-else()
-MESSAGE(STATUS "File '${file}' does not exist.")
-endif()
-endforeach(file)
+  message(STATUS "Removing file: '${file}'")
+
+  exec_program(
+    ${CMAKE_COMMAND} ARGS "-E remove ${file}"
+    OUTPUT_VARIABLE stdout
+    RETURN_VALUE result
+  )
+  if (NOT "${result}" STREQUAL 0)
+    message(FATAL_ERROR "Failed to remove file: '${file}'.")
+  endif ()
+endforeach ()


BZip2: not working for iOS

BZip2: not working for iOS

--- cmake/projects/BZip2/hunter.cmake
+++ cmake/projects/BZip2/hunter.cmake
@@ -11,6 +11,12 @@
 include(hunter_cacheable)
 include(hunter_download)
 include(hunter_pick_scheme)
+include(hunter_report_broken_package)
+
+string(COMPARE EQUAL "${CMAKE_OSX_SYSROOT}" "iphoneos" _hunter_ios)
+if(_hunter_ios)
+  hunter_report_broken_package("BZip2 is broken on iOS")
+endif()

 hunter_add_version(
     PACKAGE_NAME


Fix RPI build. Only support Raspbian Stretch for now.

--- CMake/Modules/UrhoCommon.cmake
+++ CMake/Modules/UrhoCommon.cmake
@@ -880,6 +880,8 @@
                 # Do nothing
             elseif (WIN32)
                 list (APPEND LIBS opengl32)
+            elseif (RPI)
+                list (APPEND LIBS brcmGLESv2)
             elseif (ANDROID OR ARM)
                 list (APPEND LIBS GLESv1_CM GLESv2)
             else ()


#4100 fixed, added cmake variables to mark as advanced and separated mark as advanced into 2 categories

--- scripts/cmake/ElektraCache.cmake
+++ scripts/cmake/ElektraCache.cmake
@@ -398,6 +398,12 @@

 mark_as_advanced (
 	FORCE # The following settings might be relevant to a few users:
+	DISCOUNT_DIR
+	DREDD_EXECUTABLE
+	GO_EXECUTABLE
+	Qt5QmlModels_DIR
+	TARGET_LUA_CMOD_FOLDER
+	TARGET_LUA_LMOD_FOLDER
 	GTEST_ROOT
 	BUILD_GMOCK
 	BUILD_GTEST
@@ -417,6 +423,8 @@
 	LIBGCRYPT_INCLUDE_DIR
 	XercesC_DIR
 	OPENSSL_INCLUDE_DIR
+)
+mark_as_advanced_protected_from_user (
 	LUA_EXECUTABLE # The following settings are internal (not to be changed by users):
 	FEDORA
 	CARGO_EXECUTABLE
@@ -473,4 +481,5 @@
 	GLib_LIBRARY
 	LibGit2_VERSION_HEADER
 	libuv_VERSION_HEADER
-	Qt5Svg_DIR)
+	Qt5Svg_DIR
+)


CMake: QUIET lookup of SPIRV-Tools

CMake: QUIET lookup of SPIRV-Tools

--- CMake/Dependencies.cmake
+++ CMake/Dependencies.cmake
@@ -227,7 +227,7 @@
 endif ()

 # Find glslang
-find_package(SPIRV-Tools) # glslangs own cmake is broken
+find_package(SPIRV-Tools QUIET) # glslangs own cmake is broken
 macro_log_feature(SPIRV-Tools_FOUND "glslang" "GLSL to SPIRV reference compiler" "https://github.com/KhronosGroup/glslang" FALSE "" "")

 # OpenEXR


Add include guard in the generated config file

--- src/config.h.cmake
+++ src/config.h.cmake
@@ -1,3 +1,4 @@
 // @EDIT_WARNING@
+#pragma once
 #cmakedefine GIT_INFORMATIONS "${GIT_INFORMATIONS}"
 #cmakedefine SHADERS_DIR "${SHADERS_DIR}"


Remove NO_DEFAULT_PATH from CUDA find libs

--- CMake/hoomd/FindCUDALibs.cmake
+++ CMake/hoomd/FindCUDALibs.cmake
@@ -7,7 +7,7 @@
 set(REQUIRED_CUDA_LIB_VARS "")
 if (HIP_PLATFORM STREQUAL "nvcc")
     # find libraries that go with this compiler
-    find_library(CUDA_cudart_LIBRARY cudart HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_cudart_LIBRARY cudart HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_cudart_LIBRARY)
     if(CUDA_cudart_LIBRARY AND NOT TARGET CUDA::cudart)
       add_library(CUDA::cudart UNKNOWN IMPORTED)
@@ -59,7 +59,7 @@

 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_cudadevrt_LIBRARY cudadevrt HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_cudadevrt_LIBRARY cudadevrt HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_cudadevrt_LIBRARY)
     if(CUDA_cudadevrt_LIBRARY AND NOT TARGET CUDA::cudadevrt)
       add_library(CUDA::cudadevrt UNKNOWN IMPORTED)
@@ -76,7 +76,7 @@

 if (BUILD_JIT)
 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_nvrtc_LIBRARY nvrtc HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_nvrtc_LIBRARY nvrtc HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_nvrtc_LIBRARY)
     if(CUDA_nvrtc_LIBRARY AND NOT TARGET CUDA::nvrtc)
       add_library(CUDA::nvrtc UNKNOWN IMPORTED)
@@ -114,7 +114,7 @@
 endif()

 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_cufft_LIBRARY cufft HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_cufft_LIBRARY cufft HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_cufft_LIBRARY)
     if(CUDA_cufft_LIBRARY AND NOT TARGET CUDA::cufft)
       add_library(CUDA::cufft UNKNOWN IMPORTED)
@@ -130,7 +130,7 @@
 endif()

 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_nvToolsExt_LIBRARY nvToolsExt HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_nvToolsExt_LIBRARY nvToolsExt HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_nvToolsExt_LIBRARY)
     if(CUDA_nvToolsExt_LIBRARY AND NOT TARGET CUDA::nvToolsExt)
       add_library(CUDA::nvToolsExt UNKNOWN IMPORTED)
@@ -146,7 +146,7 @@
 endif()

 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_cusolver_LIBRARY cusolver HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_cusolver_LIBRARY cusolver HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_cusolver_LIBRARY)
     if(CUDA_cusolver_LIBRARY AND NOT TARGET CUDA::cusolver)
       add_library(CUDA::cusolver UNKNOWN IMPORTED)
@@ -162,7 +162,7 @@
 endif()

 if (HIP_PLATFORM STREQUAL "nvcc")
-    find_library(CUDA_cusparse_LIBRARY cusparse HINTS ${CUDA_LIB_PATH} NO_DEFAULT_PATH)
+    find_library(CUDA_cusparse_LIBRARY cusparse HINTS ${CUDA_LIB_PATH})
     mark_as_advanced(CUDA_cusparse_LIBRARY)
     if(CUDA_cusparse_LIBRARY AND NOT TARGET CUDA::cusparse)
       add_library(CUDA::cusparse UNKNOWN IMPORTED)


- fix issue with numl find script

- fix issue with numl find script

--- CMakeModules/FindLIBNUML.cmake
+++ CMakeModules/FindLIBNUML.cmake
@@ -53,10 +53,10 @@
 endif (NOT LIBNUML_INCLUDE_DIR)

 find_library(LIBNUML_LIBRARY
-    NAMES sbml-static
-          sbml
-          libsbml-static
-          libsbml
+    NAMES numl-static
+          numl
+          libnuml-static
+          libnuml
     PATHS $ENV{LIBNUML_DIR}/lib
           $ENV{LIBNUML_DIR}
           ${LIBSEDML_DEPENDENCY_DIR}
@@ -72,8 +72,8 @@

 if (NOT LIBNUML_LIBRARY)
     find_library(LIBNUML_LIBRARY
-        NAMES sbml-static
-              sbml)
+        NAMES numl-static
+              numl)
 endif (NOT LIBNUML_LIBRARY)

 if (NOT LIBNUML_LIBRARY)


removed automatically appended ImageFile from name in CMake

Change-Id: I636918ad2c21a7bfdcc46f1ab9e96e2a80c81e7a

--- CMake/generate_filter_source.cmake
+++ CMake/generate_filter_source.cmake
@@ -60,8 +60,8 @@
   # Set common variables
   set ( expand_template_script ${SimpleITK_SOURCE_DIR}/Utilities/ExpandTemplate.lua )
   set ( template_include_dir ${SimpleITK_SOURCE_DIR}/TemplateComponents )
-  set ( output_h "${output_dir}/include/sitk${FILENAME}ImageFilter.h" )
-  set ( output_cxx "${output_dir}/src/sitk${FILENAME}ImageFilter.cxx" )
+  set ( output_h "${output_dir}/include/sitk${FILENAME}.h" )
+  set ( output_cxx "${output_dir}/src/sitk${FILENAME}.cxx" )

   set ( input_json_file ${input_dir}/json/${FILENAME}.json )
   set ( template_file_h ${input_dir}/templates/sitkImageFilterTemplate.h.in )
@@ -178,8 +178,8 @@
   file ( APPEND ${generated_headers_h} "#define __SimpleITK${directory_name}GeneratedHeaders_h\n")

   foreach ( filter ${GENERATED_FILTER_LIST} )
-    file ( APPEND ${generated_headers_h} "#include \"sitk${filter}ImageFilter.h\"\n" )
-    file ( APPEND ${generated_headers_i} "%include \"sitk${filter}ImageFilter.h\"\n" )
+    file ( APPEND ${generated_headers_h} "#include \"sitk${filter}.h\"\n" )
+    file ( APPEND ${generated_headers_i} "%include \"sitk${filter}.h\"\n" )
   endforeach()

   file ( APPEND ${generated_headers_h} "#endif\n")


Removed debug output

Removed debug output

--- CMakeModules/FindOpenCascade.cmake
+++ CMakeModules/FindOpenCascade.cmake
@@ -49,8 +49,6 @@
         /opt/lib
         /usr/freeware/lib64
         )
-
-        MESSAGE("#Foundlibrary " ${${MYLIBRARY}})

 ENDMACRO()


pw_build/CMake: Verify HEADERS exist

pw_build/CMake: Verify HEADERS exist

As of CMake 3.22 there is no official way to associate headers
with targets, although this is targeted for the 3.23 release.

That being said, listing them in the sources helps IDEs and
enumerating them in the CMake build rules enables consistency
with other build languages and documents to a developer which
target they should depend on.

This change extends pw_add_module_library to verify the specified
HEADERS actually exists and throws an actionable fatal error
otherwise.

Change-Id: I7df5e3049694a9482f823f035d3c0083e8668f0a
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/82430
Pigweed-Auto-Submit: Ewout van Bekkum <638f134dbc68778d6b859fb04a64baea2b00b021@google.com>
Reviewed-by: Wyatt Hepler <cca3bedb37979eacd157a9bceb473582df8aea1e@google.com>
Commit-Queue: Auto-Submit <14637eda5603879df170705285bf30f5996692f0@pigweed.google.com.iam.gserviceaccount.com>

--- pw_build/pigweed.cmake
+++ pw_build/pigweed.cmake
@@ -200,6 +200,21 @@
   endif()

   add_library("${NAME}" EXCLUDE_FROM_ALL ${arg_HEADERS} ${arg_SOURCES})
+
+  # CMake 3.22 does not have a notion of target_headers yet, so in the mean
+  # time we ask for headers to be specified for consistency with GN & Bazel and
+  # to improve the IDE experience. However, we do want to ensure all the headers
+  # which are otherwise ignored by CMake are present.
+  #
+  # See https://gitlab.kitware.com/cmake/cmake/-/issues/22468 for adding support
+  # to CMake to associate headers with targets properly for CMake 3.23.
+  foreach(header IN ITEMS ${arg_HEADERS})
+    get_filename_component(header "${header}" ABSOLUTE)
+    if(NOT EXISTS ${header})
+      message(FATAL_ERROR "Header not found: \"${header}\"")
+    endif()
+  endforeach()
+
   if(NOT "${arg_PUBLIC_INCLUDES}" STREQUAL "")
     target_include_directories("${NAME}" PUBLIC ${arg_PUBLIC_INCLUDES})
   else()


Corrects for some policy change in cmake

--- scripts/PythonModule.cmake
+++ scripts/PythonModule.cmake
@@ -175,7 +175,7 @@
     file(RELATIVE_PATH targetname_copy "${PROJECT_SOURCE_DIR}"
         "${CMAKE_CURRENT_SOURCE_DIR}")
     string(REGEX REPLACE "( |/)" "_" targetname_copy "${targetname_copy}")
-    if("${targetname_copy}" STREQUAL "")
+    if(targetname_copy STREQUAL "")
         set(targetname_copy "${${py}_TARGET}-copy")
     else()
         set(targetname_copy "${targetname_copy}-copy")


/Zc:twoPhase- no longer needed since Microsoft have fixed their compiler/headers in the latest VS 2017

--- scripts/cmake/common.cmake
+++ scripts/cmake/common.cmake
@@ -149,7 +149,6 @@
 if(MSVC)
     add_compiler_flags(/std:c++latest) # for post c++14 updates in MSVC
     add_compiler_flags(/permissive-)   # force standard conformance - this is the better flag than /Za
-    add_compiler_flags(/Zc:twoPhase-)  # use old behavior of MSVC compiler for two-phase lookup - version 15.5.1 has trouble with combaseapi.h ...
     add_compiler_flags(/WX)
     add_compiler_flags(/Wall) # turns on warnings from levels 1 through 4 which are off by default - https://msdn.microsoft.com/en-us/library/23k5d385.aspx


Blank space modifications

Blank space modifications

--- scripts/CheckCXX11Features.cmake
+++ scripts/CheckCXX11Features.cmake
@@ -1,14 +1,14 @@
 # Checks for C++11 features
-#
+#
 # USAGE: There are two functions
 #
-# cxx11_find_all_features(OUTPUT_VARIABLE)
+# cxx11_find_all_features(OUTPUT_VARIABLE)
 # This function returns a variable with all possible features.
 #
 # cxx11_feature_check([feature feature] [REQUIRED [feature feature]])
 # If no arguments are provided, then checks all available features
 # Features appeacing before REQUIRED are optional.
-# If arguments are provided and those features are available, sets
+# If arguments are provided and those features are available, sets
 # the variable HAS_CXX11_FEATURENAME, where FEATURENAME is the input in capital letters.
 # Fails if required feature are not available
 #
@@ -140,12 +140,12 @@
       list(REMOVE_ITEM ALL_FEATURE_FILES ${filename})
     endif()
   endforeach()
-
+
   list(LENGTH ALL_FEATURE_FILES NFILES)
   if(NOT ${NFILES} EQUAL 1)
     message(FATAL_ERROR "[c++11] Expected to find only one feature. Found ${NFILES} -- ${ALL_FEATURE_FILES}.")
   endif(NOT ${NFILES} EQUAL 1)
-
+
   # Now we know which file corresponds to option.
   get_filename_component(basename ${ALL_FEATURE_FILES} NAME_WE)
   # If has feature number, extract it
@@ -172,7 +172,7 @@

   # MinGW has not implemented std::random_device fully yet. Unfortunately, this can only be detected
   # by running a program which tries to call std::random_device. However that generates an error that
-  # is *not* caught by CMake's try_run.
+  # is *not* caught by CMake's try_run.
   if(MSYS)
     list(REMOVE_ITEM OPTIONALS "random_device")
     list(FIND REQUIRED "random_device" feature_was_found)


cmake: Improve compiler checks

cmake: Improve compiler checks

Always use -Werror to detect compiler flags if possible.

Signed-off-by: Andreas Schneider <5be00ddc76278cf6077f5047ca3384a88460c671@cryptomilk.org>

--- CompilerChecks.cmake
+++ CompilerChecks.cmake
@@ -2,6 +2,20 @@
 include(CheckCCompilerFlagSSP)

 if (UNIX)
+    #
+    # Check for -Werror turned on if possible
+    #
+    # This will prevent that compiler flags are detected incorrectly.
+    #
+    check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
+    if (REQUIRED_FLAGS_WERROR)
+        set(CMAKE_REQUIRED_FLAGS "-Werror")
+
+        if (PICKY_DEVELOPER)
+            list(APPEND SUPPORTED_COMPILER_FLAGS "-Werror")
+        endif()
+    endif()
+
     add_c_compiler_flag("-std=gnu99" SUPPORTED_COMPILER_FLAGS)
     add_c_compiler_flag("-pedantic" SUPPORTED_COMPILER_FLAGS)
     add_c_compiler_flag("-pedantic-errors" SUPPORTED_COMPILER_FLAGS)
@@ -28,27 +42,19 @@
     add_c_compiler_flag("-Werror=strict-overflow" SUPPORTED_COMPILER_FLAGS)
     add_c_compiler_flag("-Wstrict-overflow=2" SUPPORTED_COMPILER_FLAGS)
     add_c_compiler_flag("-Wno-format-zero-length" SUPPORTED_COMPILER_FLAGS)
+
+    check_c_compiler_flag("-Wformat" REQUIRED_FLAGS_WFORMAT)
+    if (REQUIRED_FLAGS_WFORMAT)
+        list(APPEND SUPPORTED_COMPILER_FLAGS "-Wformat")
+        set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wformat")
+    endif()
     add_c_compiler_flag("-Wformat-security" SUPPORTED_COMPILER_FLAGS)
     add_c_compiler_flag("-Werror=format-security" SUPPORTED_COMPILER_FLAGS)

-    #
-    # Check for -f options with -Werror turned on if possible
-    #
-    # This will prevent that compiler flags are detected incorrectly.
-    #
-    check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
-    if (REQUIRED_FLAGS_WERROR)
-        set(CMAKE_REQUIRED_FLAGS "-Werror")
-    endif()
+    # Allow zero for a variadic macro argument
+    add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)

     add_c_compiler_flag("-fno-common" SUPPORTED_COMPILER_FLAGS)
-
-    check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
-    if (WITH_STACK_PROTECTOR)
-        list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
-    endif()
-    unset(CMAKE_REQUIRED_FLAGS)
-

     if (CMAKE_BUILD_TYPE)
         string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
@@ -57,11 +63,18 @@
         endif()
     endif()

+    check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
+    if (WITH_STACK_PROTECTOR)
+        list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
+    endif()
+
     if (PICKY_DEVELOPER)
-        add_c_compiler_flag("-Werror" SUPPORTED_COMPILER_FLAGS)
         add_c_compiler_flag("-Wno-error=deprecated-declarations" SUPPORTED_COMPILER_FLAGS)
         add_c_compiler_flag("-Wno-error=tautological-compare" SUPPORTED_COMPILER_FLAGS)
     endif()
+
+    # Unset CMAKE_REQUIRED_FLAGS
+    unset(CMAKE_REQUIRED_FLAGS)
 endif()

 if (MSVC)
@@ -77,9 +90,4 @@
     add_c_compiler_flag("-Wno-deprecated-declarations" SUPPORTED_COMPILER_FLAGS)
 endif()

-if (BSD)
-    # Allow zero for a variadic macro argument
-    add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
-endif()
-
 set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE)


Corrected the version string.

Corrected the version string.

--- CMake/Version.cmake
+++ CMake/Version.cmake
@@ -4,5 +4,6 @@
 SET(VERSION_RELEASE 0)

 # this is from makefile, do not edit it
-SET(VERSION_STRING "$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)")
-SET(SOVERSION_STRING "$(VERSION_MAJOR).$(VERSION_MINOR)")
+SET(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}")
+SET(SOVERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
+


Bump version to 3.1

Bump version to 3.1

--- CMake/version.cmake
+++ CMake/version.cmake
@@ -1,3 +1,3 @@
 set (VV_VERSION_MAJOR 3)
-set (VV_VERSION_MINOR 0)
-set (VV_VERSION_PATCH 11)
+set (VV_VERSION_MINOR 1)
+set (VV_VERSION_PATCH 0)


[CI] help for debugging ctest failures

[CI] help for debugging ctest failures

--- CI/cmake/Docker.cmake
+++ CI/cmake/Docker.cmake
@@ -91,7 +91,7 @@
   string(REPLACE ":" "-" DOCKER_WORKDIR_VOLUME ${DOCKER_WORKDIR_VOLUME})
   string(REPLACE "." "-" DOCKER_WORKDIR_VOLUME ${DOCKER_WORKDIR_VOLUME})

-  set(CTEST_OPTIONS_WITHOUT_DOCKER)
+  set(CTEST_OPTIONS_WITHOUT_DOCKER "--output-on-failure")
   # List of options (-DOPTION=VALUE ...) to be passed to ctest
   # Warning : these are not siconos conf. options for cmake but
   # the options needed by ctest to prepare the pipeline (cmake, make ...)


Corrected a variable name in grpc_helper

Additionally the grpc_helper now defines the proto file as main_dependency.
This makes it look nicer in Visual Studio, at least according to the
cmake docs.

--- contrib/conan/recipes/grpc/gRPCTargets-helpers.cmake
+++ contrib/conan/recipes/grpc/gRPCTargets-helpers.cmake
@@ -34,7 +34,8 @@
             "${bin_dir}" -I ${src_folder}
             --plugin=protoc-gen-grpc="${_HELPER_GRPC_CPP_PLUGIN}"
             "${src_filepath}"
-          DEPENDS "${source_filepath}" "${bin_dir}")
+          MAIN_DEPENDENCY "${src_filepath}"
+          DEPENDS "${bin_dir}")

         add_library(${target_name} OBJECT)
         target_include_directories(${target_name} PUBLIC ${bin_dir})


Added _WIN32_WINNT-def to grpc helper targets

On Windows grpc-auto-generated compilation units
need the _WIN32_WINNT macro set to at least Win Vista.
(Windows XP is not supported anymore.)

--- contrib/conan/recipes/grpc/gRPCTargets-helpers.cmake
+++ contrib/conan/recipes/grpc/gRPCTargets-helpers.cmake
@@ -43,6 +43,8 @@
           ${target_name} PUBLIC gRPC::grpc++_reflection gRPC::grpc++_unsecure
                                 protobuf::libprotobuf)
         target_sources(${target_name} PRIVATE "${proto_cpp}" "${grpc_cpp}")
+        target_compile_definitions(${target_name} PRIVATE -D_WIN32_WINNT=0x0700)
+        target_compile_definitions(${target_name} PRIVATE -DNTDDI_VERSION=0x06030000)

       endif()


CUDA runtime: bail out if nvcc compilation fails.

--- runtime/hipacc_cu.hpp.cmake
+++ runtime/hipacc_cu.hpp.cmake
@@ -659,25 +659,25 @@
 }
 #else
 void hipaccCompileCUDAToModule(CUmodule &module, std::string file_name, int cc, std::vector<std::string> &build_options) {
-    char line[FILENAME_MAX];
-    FILE *fpipe;
-
-    std::stringstream ss;
-    ss << cc;
-
-    std::string command = "${NVCC} -ptx -arch=compute_" + ss.str() + " ";
+    std::string command = "${NVCC} -ptx -arch=compute_" + std::to_string(cc) + " ";
     for (auto option : build_options) command += option + " ";
     command += file_name + " -o " + file_name + ".ptx 2>&1";

-    if (!(fpipe = (FILE *)popen(command.c_str(), "r"))) {
+    if (auto stream = popen(command.c_str(), "r")) {
+        char line[FILENAME_MAX];
+
+        while (fgets(line, sizeof(char) * FILENAME_MAX, stream)) {
+            std::cerr << line;
+        }
+
+        int exit_status = pclose(stream);
+        if (WEXITSTATUS(exit_status)) {
+            exit(EXIT_FAILURE);
+        }
+    } else {
         perror("Problems with pipe");
         exit(EXIT_FAILURE);
     }
-
-    while (fgets(line, sizeof(char) * FILENAME_MAX, fpipe)) {
-        std::cerr << line;
-    }
-    pclose(fpipe);

     std::string ptx_filename = file_name + ".ptx";
     std::ifstream ptx_file(ptx_filename);


Add INSTALL hook to package lookup

Add INSTALL hook to package lookup

--- scripts/PackageLookup.cmake
+++ scripts/PackageLookup.cmake
@@ -160,13 +160,33 @@
     endif()
 endmacro()

+# Returns name of given hook and package in hook_script variable
+function(get_lookup_hookscript_name hook package)
+    string(TOUPPER "${hook}" hook)
+    if("${hook}" STREQUAL "POST_LOOKUP")
+        set(filename "${EXTERNAL_ROOT}/hooks/post_lookup/${package}.cmake")
+    elseif("${hook}" STREQUAL "INSTALL")
+        set(filename "${EXTERNAL_ROOT}/hooks/install/${package}.cmake")
+    else()
+        set(hooks POST_LOOKUP INSTALL)
+        message(FATAL_ERROR "Hook argument(${hook}) should be one of ${hooks}.")
+    endif()
+    list(LENGTH ARGN nargs)
+    set(variable hook_script)
+    if(NOT nargs EQUAL 0)
+        list(GET ARGN 0 variable)
+    endif()
+    set(${variable} "${filename}" PARENT_SCOPE)
+endfunction()
+
 # Looks for a lookup package file and includes it.
 macro(lookup_package package)

-    # include potential post lookup script
+    # include potential hooks
     if(${package}_BUILT_AS_EXTERNAL_PROJECT)
-        if(EXISTS "${EXTERNAL_ROOT}/post_lookup/${package}.cmake")
-            include("${EXTERNAL_ROOT}/post_lookup/${package}.cmake")
+        get_lookup_hookscript_name(post_lookup ${package})
+        if(EXISTS "${hook_script}")
+            include("${hook_script}")
         endif()
     endif()

@@ -201,6 +221,12 @@
     # This is a problem with changing cmake practices.
     if(${PACKAGE}_FOUND AND NOT "${package}" STREQUAL "${PACKAGE}")
         set(${package}_FOUND ${${PACKAGE}_FOUND})
+    endif()
+    if(${package}_FOUND AND ${package}_BUILT_AS_EXTERNAL_PROJECT)
+        get_lookup_hookscript_name(install ${package})
+        if(EXISTS "${hook_script}")
+            install(SCRIPT "${hook_script}")
+        endif()
     endif()
     # If package is not found, then look for a recipe to download and build it
     if(NOT ${package}_FOUND OR ${package}_LOOKUP_BUILD OR ${package}_KEEP)
@@ -268,25 +294,18 @@
 # A script that is executed once a package has been built locally
 # This function should be called from the lookup recipe
 function(write_lookup_hook hook package)
-    cmake_parse_arguments(_wpls${package} "APPEND" "" "" ${ARGN})
-    # checks the hook argument for correctness
-    string(TOUPPER "${hook}" hook)
-    set(hooks POST_LOOKUP)
-    list(FIND hooks "${hook}" correct_hook)
-    if(correct_hook EQUAL -1)
-        message(FATAL_ERROR "Hook argument(${hook}) should be one of ${hooks}.")
-    endif()
+    cmake_parse_arguments(_wpls${package} "APPEND" "SCRIPTNAME" "" ${ARGN})

     # Sets filename. That's the only difference between hooks, in practice.
-    if("${hook}" STREQUAL "POST_LOOKUP")
-        set(filename "${EXTERNAL_ROOT}/post_lookup/${package}.cmake")
-    endif()
-
+    get_lookup_hookscript_name(${hook} ${package})
     # Then write or append to file.
     if(_wpls${package}_APPEND)
-        file(APPEND "${filename}" ${_wpls${package}_UNPARSED_ARGUMENTS})
+        file(APPEND "${hook_script}" ${_wpls${package}_UNPARSED_ARGUMENTS})
     else()
-        file(WRITE "${filename}" ${_wpls${package}_UNPARSED_ARGUMENTS})
+        file(WRITE "${hook_script}" ${_wpls${package}_UNPARSED_ARGUMENTS})
+    endif()
+    if(_wpls${package}_SCRIPTNAME)
+        set(${_wpls${package}_SCRIPTNAME} "${hook_script}" PARENT_SCOPE)
     endif()
 endfunction()


Fix broken build when download_project is invoked in a subdirectory

This commit addresses pull request #2 and issue #4.

--- DownloadProject.cmake
+++ DownloadProject.cmake
@@ -2,6 +2,8 @@
 #
 # PROVIDES:
 #   download_project( PROJ projectName
+#                    [PREFIX prefixDir]
+#                    [DOWNLOAD_DIR downloadDir]
 #                    [SOURCE_DIR srcDir]
 #                    [BINARY_DIR binDir]
 #                    [QUIET]
@@ -27,6 +29,14 @@
 #       and build directories to be located in a specific place. The contents of
 #       projectName_SOURCE_DIR and projectName_BINARY_DIR will be populated with the
 #       locations used whether you provide SOURCE_DIR/BINARY_DIR or not.
+#
+#       The DOWNLOAD_DIR argument does not normally need to be set. It controls the
+#       location of the temporary CMake build used to perform the download.
+#
+#       The PREFIX argument can be provided to change the base location of the default
+#       values of DOWNLOAD_DIR, SOURCE_DIR and BINARY_DIR. If all of those three arguments
+#       are provided, then PREFIX will have no effect. The default value for PREFIX is
+#       CMAKE_BINARY_DIR.
 #
 #       The QUIET option can be given if you do not want to show the output associated
 #       with downloading the specified project.
@@ -61,7 +71,7 @@
 #                    QUIET
 #   )
 #
-#   add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
+#   add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR})
 #
 #========================================================================================

@@ -75,6 +85,8 @@
     set(options QUIET)
     set(oneValueArgs
         PROJ
+        PREFIX
+        DOWNLOAD_DIR
         SOURCE_DIR
         BINARY_DIR
         # Prevent the following from being passed through
@@ -95,12 +107,21 @@
         message(STATUS "Downloading/updating ${DL_ARGS_PROJ}")
     endif()

+    # Set up where we will put our temporary CMakeLists.txt file and also
+    # the base point below which the default source and binary dirs will be
+    if (NOT DL_ARGS_PREFIX)
+        set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}")
+    endif()
+    if (NOT DL_ARGS_DOWNLOAD_DIR)
+        set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-download")
+    endif()
+
     # Ensure the caller can know where to find the source and build directories
     if (NOT DL_ARGS_SOURCE_DIR)
-        set(DL_ARGS_SOURCE_DIR "${CMAKE_BINARY_DIR}/${DL_ARGS_PROJ}-src")
+        set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-src")
     endif()
     if (NOT DL_ARGS_BINARY_DIR)
-        set(DL_ARGS_BINARY_DIR "${CMAKE_BINARY_DIR}/${DL_ARGS_PROJ}-build")
+        set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJ}-build")
     endif()
     set(${DL_ARGS_PROJ}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE)
     set(${DL_ARGS_PROJ}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE)
@@ -109,14 +130,14 @@
     # If we've already previously done these steps, they will not cause
     # anything to be updated, so extra rebuilds of the project won't occur.
     configure_file("${_DownloadProjectDir}/DownloadProject.CMakeLists.cmake.in"
-                   ${DL_ARGS_PROJ}-download/CMakeLists.txt)
+                   "${DL_ARGS_DOWNLOAD_DIR}/CMakeLists.txt")
     execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
                     ${OUTPUT_QUIET}
-                    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${DL_ARGS_PROJ}-download"
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
     )
     execute_process(COMMAND ${CMAKE_COMMAND} --build .
                     ${OUTPUT_QUIET}
-                    WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${DL_ARGS_PROJ}-download"
+                    WORKING_DIRECTORY "${DL_ARGS_DOWNLOAD_DIR}"
     )

 endfunction()


COMP: update 3DBarolo git

COMP: update 3DBarolo git

--- SuperBuild/External_bbarolo.cmake
+++ SuperBuild/External_bbarolo.cmake
@@ -33,7 +33,7 @@
   ExternalProject_Add(${proj}
     ${${proj}_EP_ARGS}
     GIT_REPOSITORY "${git_protocol}://github.com/Punzo/Bbarolo"
-    GIT_TAG "01a4fdec4810075e22f606c9018c72d5253cfe29"
+    GIT_TAG "709b76907e3c58dd75119650968e62c8e6c316b4"
     SOURCE_DIR ${${proj}_SOURCE_DIR}
     BINARY_DIR ${${proj}_BINARY_DIR}
     CMAKE_CACHE_ARGS


fix target include path

fix target include path

--- Modules/Core/add-tart-target.cmake
+++ Modules/Core/add-tart-target.cmake
@@ -10,8 +10,7 @@
   FIND_PACKAGE_TART_YAML_FILEPATH("${TART_CURRENT_WORKSPACE_DIR}" ${PACKAGE_NAME} PACKAGE_DIR)

   GET_PACKAGE_FILES("${PACKAGE_DIR}" LIB_SOURCES INCLUDE_DIR)
-
-
+
   TART_DEBUG("${PACKAGE_NAME} sources: ${LIB_SOURCES}")
   IF(${TARGET_TYPE} STREQUAL "LIBRARY")
     ADD_LIBRARY(${PACKAGE_NAME} STATIC ${LIB_SOURCES})
@@ -22,7 +21,7 @@
   ELSE()
     ADD_EXECUTABLE(${PACKAGE_NAME} ${LIB_SOURCES})
   ENDIF()
-  TARGET_INCLUDE_DIRECTORIES(${PACKAGE_NAME} PRIVATE "${PACKAGE_DIR}/${INCLUDE_DIR}")
+  TARGET_INCLUDE_DIRECTORIES(${PACKAGE_NAME} PRIVATE "${INCLUDE_DIR}")

   # SET_TARGET_PROPERTIES(${PACKAGE_NAME} PROPERTY CXX_STANDARD 14)


Add leak info in Valgrind

Add leak info in Valgrind

Add leak information in Valgrind log file (option --leak-check=full).

--- build/Valgrind.cmake
+++ build/Valgrind.cmake
@@ -12,8 +12,8 @@

 macro(VALGRIND name)
 	if (DO_VALGRIND)
-		execute_process(COMMAND ${VALGRIND_COMMAND} --gen-suppressions=all --suppressions=${CTEST_MODULE_DIR}/Valgrind.sup
-			--log-file=${name}-valgrind.txt ${ARGN})
+		execute_process(COMMAND ${VALGRIND_COMMAND} --leak-check=full --gen-suppressions=all
+			--suppressions=${CTEST_MODULE_DIR}/Valgrind.sup --log-file=${name}-valgrind.txt ${ARGN})
 	else()
 		execute_process(COMMAND ${ARGN})
 	endif()


Split off 3.10.4

Split off 3.10.4

Signed-off-by: Richard Chapman <5900d56196fe29dba8e3ae556d57eae28e9f0195@hpccsystems.com>

--- version.cmake
+++ version.cmake
@@ -4,7 +4,7 @@
 set ( HPCC_PROJECT "community" )
 set ( HPCC_MAJOR 3 )
 set ( HPCC_MINOR 10 )
-set ( HPCC_POINT 3 )
+set ( HPCC_POINT 5 )
 set ( HPCC_MATURITY "closedown" )
 set ( HPCC_SEQUENCE 1 )
 ###


* check: add checking dl library;

* check: add checking dl library;

--- check.cmake
+++ check.cmake
@@ -2,6 +2,7 @@

 include(CheckTypeSize)
 include(CheckFunctionExists)
+include(CheckLibraryExists)

 # check ln
 find_program(LN ln)
@@ -61,6 +62,12 @@
 set(CMAKE_EXTRA_INCLUDE_FILES sched.h)
 check_function_exists(setns HAVE_DECL_SETNS)

+# check dl
+CHECK_LIBRARY_EXISTS(dl dlsym "" DL_FOUND)
+if (NOT DL_FOUND)
+	message(FATAL_ERROR "*** Dynamic linking loader library not found ***")
+endif()
+
 # dependencies
 find_package(PkgConfig REQUIRED)


PKG: attention to itk dlls

PKG: attention to itk dlls

--- Packaging/install_importlibs.cmake
+++ Packaging/install_importlibs.cmake
@@ -1,20 +1,23 @@
 # This is more messed up that you might think.
 # On windows we cannot track dependency on .lib files like dll
 function(install_importlibs)
-
-  if(WIN32)
-    #ALL .lib files are required for building
-    #eg: gdal.dll will have gdal_i.lib which is
-    #needed when you do cmake configure for projects
-    #using OTB. Hence the *.lib regex is non optional
-    #and cannot be optimized at any level.
-    #Only thing you can control is to create only those
-    #required .lib files in install directory.
-    file(GLOB import_lib_files
-      "${SUPERBUILD_INSTALL_DIR}/lib/*.lib")
-    foreach( import_lib_file ${import_lib_files})
-      install_rule(${import_lib_file})
-    endforeach()
+  if(NOT WIN32)
     return()
   endif()
+
+  #ALL .lib files are required for building
+  #eg: gdal.dll will have gdal_i.lib which is
+  #needed when you do cmake configure for projects
+  #using OTB. Hence the *.lib regex is non optional
+  #and cannot be optimized at any level.
+  #Only thing you can control is to create only those
+  #required .lib files in install directory.
+  file(GLOB import_lib_files
+    "${SUPERBUILD_INSTALL_DIR}/lib/*.lib"
+    "${SUPERBUILD_INSTALL_DIR}/bin/itk*.dll"
+    )
+  foreach( import_lib_file ${import_lib_files})
+    install_rule(${import_lib_file})
+  endforeach()
+
 endfunction()


lemon.cmake: - Explicitly disable GLPK support - Added a comment about (lack of) clang support for this package.

--- lemon.cmake
+++ lemon.cmake
@@ -10,6 +10,10 @@
 include (ExternalSource)
 include (BuildSupport)

+# FIXME: v1.2.3 of lemon doesn't compile under clang.
+# From their issue tracker (#449), it looks like the next release (v1.3) will fix this.
+# For now, this means that we MUST use gcc for this package.
+# As soon as v1.3 is ready, we should try to upgrade.
 external_source (lemon
     1.2.3
     lemon-1.2.3.tar.gz
@@ -26,9 +30,16 @@
     	${lemon_SRC_DIR}/lemon/CMakeLists.txt ${PATCH_DIR}/lemon.patch

     CONFIGURE_COMMAND   ${BUILDEM_ENV_STRING} ${CMAKE_COMMAND} ${lemon_SRC_DIR}
-        -DBUILD_SHARED_LIBS=1
+        -DBUILD_SHARED_LIBS=ON
         -DCMAKE_INSTALL_PREFIX=${BUILDEM_DIR}
         -DCMAKE_PREFIX_PATH=${BUILDEM_DIR}
+        # Lemon can be optionally built with glpk to enable the LP solver.
+        # We don't want to build with glpk because it isn't needed for cylemon.
+        # Kill these cache variables to make sure we don't use it
+        # (avoid potential linker errors if cmake finds a version of glpk on our system)
+        -DGLPK_LIBRARY=
+        -DGLPK_INCLUDE_DIR=
+        -DGLPK_ROOT_DIR=

     BUILD_COMMAND       ${BUILDEM_ENV_STRING} make
     INSTALL_COMMAND     ${BUILDEM_ENV_STRING} make install


W.I.P.

W.I.P.

--- src/PackSource.cmake
+++ src/PackSource.cmake
@@ -21,6 +21,7 @@
 #     + PROJECT_NAME: Project name
 #     + VENDOR: Organization that issue this project.
 #     + PRJ_VER: Project version
+#     + PRJ_SUMMARY: (Optional) Project summary
 #     + PACK_SOURCE_IGNORE_FILES: A list of regex filename pattern to indicate
 #       the files to be excluded. Note that cmake generated file
 #       (PACK_SOURCE_IGNORE_FILE_CMAKE) is already in this list.
@@ -88,14 +89,13 @@
 	    SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README)
 	ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/README)

-	IF(DEFINED PROJECT_DESCRIPTION)
-	    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
-	ENDIF(DEFINED PROJECT_DESCRIPTION)
+	IF(DEFINED PRJ_SUMMARY)
+	    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PRJ_SUMMARY}")
+	ENDIF(DEFINED PRJ_SUMMARY)

 	SET(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PRJ_VER}-Source")
 	SET(${var} "${CPACK_SOURCE_PACKAGE_FILE_NAME}.${_pack_source_ext}")

-	# IF VENDOR is empty, then use AUTHORS instead
 	SET(CPACK_PACKAGE_VENDOR "${VENDOR}")

 	INCLUDE(CPack)


Fix Mac build with the renamed boost libs

--- indra/cmake/Boost.cmake
+++ indra/cmake/Boost.cmake
@@ -38,9 +38,9 @@
           debug libboost_signals-vc80-mt-gd-${BOOST_VERSION})
     endif (MSVC71)
   elseif (DARWIN)
-    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
-    set(BOOST_REGEX_LIBRARY boost_regex-mt)
-    set(BOOST_SIGNALS_LIBRARY boost_signals-mt)
+    set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-xgcc40-mt)
+    set(BOOST_REGEX_LIBRARY boost_regex-xgcc40-mt)
+    set(BOOST_SIGNALS_LIBRARY boost_signals-xgcc40-mt)
   elseif (LINUX)
     set(BOOST_PROGRAM_OPTIONS_LIBRARY boost_program_options-gcc41-mt)
     set(BOOST_REGEX_LIBRARY boost_regex-gcc41-mt)


Simplify to postgres variant

Simplify to postgres variant

--- lib/FindPGSQL.cmake
+++ lib/FindPGSQL.cmake
@@ -18,12 +18,7 @@
 )

 # Look for the library
-FIND_LIBRARY(PGSQL_LIBRARY
-	NAMES
-		pq
-	PATHS
-		/usr/lib
-		/usr/local/lib)
+FIND_LIBRARY(PGSQL_LIBRARY NAMES pq)

 FIND_LIBRARY(GSASL_LIBRARY
 	NAMES
@@ -32,6 +27,7 @@
 		/usr/lib
 		/usr/local/lib)

+# SASL, kerberos, gssapi are all optional.
 IF (GSASL_LIBRARY STREQUAL "GSASL_LIBRARY-NOTFOUND")
 	SET(GSASL_LIBRARY)
 ENDIF (GSASL_LIBRARY STREQUAL "GSASL_LIBRARY-NOTFOUND")
@@ -65,30 +61,31 @@
 ENDIF (GSSAPI_KRB5_LIBRARY STREQUAL "GSSAPI_KRB5_LIBRARY-NOTFOUND")

 # Copy the results to the output variables.
-IF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY AND KRB5_LIBRARY AND
-		GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)
+IF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
+	# AND KRB5_LIBRARY AND GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)
+
 	SET(PGSQL_FOUND 1)
-	SET(PGSQL_LIBRARIES ${PGSQL_LIBRARY}
-			com_err crypto ssl ldap
-			${KRB5_LIBRARY} ${GSSAPI_KRB5_LIBRARY} ${GSASL_LIBRARY})
+	SET(PGSQL_LIBRARIES ${PGSQL_LIBRARY} )
+			# com_err crypto ssl ldap
+			# ${KRB5_LIBRARY} ${GSSAPI_KRB5_LIBRARY} ${GSASL_LIBRARY})
 	SET(PGSQL_INCLUDE_DIRS ${PGSQL_INCLUDE_DIR})
-ELSE (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY AND KRB5_LIBRARY AND
-		GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)
+ELSE (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
+	#  AND KRB5_LIBRARY AND GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)
 	SET(PGSQL_FOUND 0)
 	SET(PGSQL_LIBRARIES)
 	SET(PGSQL_INCLUDE_DIRS)
-ENDIF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY AND KRB5_LIBRARY AND
-		GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)
+ENDIF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY)
+	# AND KRB5_LIBRARY AND GSSAPI_KRB5_LIBRARY AND GSASL_LIBRARY)

 # Report the results.
 IF (NOT PGSQL_FOUND)
-	IF (NOT GSASL_LIBRARY)
-		SET(PGSQL_DIR_MESSAGE "PostgreSQL missing required library. PostgreSQL support requires the Gnu SASL library.")
-	ELSEIF (NOT KRB5_LIBRARY OR NOT GSSAPI_KRB5_LIBRARY)
-		SET(PGSQL_DIR_MESSAGE "PostgreSQL missing required library. PostgreSQL support requires the MIT Kerberos library.")
-	ELSE (NOT GSASL_LIBRARY)
-		SET(PGSQL_DIR_MESSAGE "PostgreSQL was not found. Make sure PGSQL_LIBRARY and PGSQL_INCLUDE_DIR are set.")
-	ENDIF (NOT GSASL_LIBRARY)
+	# IF (NOT GSASL_LIBRARY)
+	#	SET(PGSQL_DIR_MESSAGE "PostgreSQL missing required library. PostgreSQL support requires the Gnu SASL library.")
+	# ELSEIF (NOT KRB5_LIBRARY OR NOT GSSAPI_KRB5_LIBRARY)
+	#	SET(PGSQL_DIR_MESSAGE "PostgreSQL missing required library. PostgreSQL support requires the MIT Kerberos library.")
+	# ELSE (NOT GSASL_LIBRARY)
+	#	SET(PGSQL_DIR_MESSAGE "PostgreSQL was not found. Make sure PGSQL_LIBRARY and PGSQL_INCLUDE_DIR are set.")
+	# ENDIF (NOT GSASL_LIBRARY)
 	IF (NOT PGSQL_FIND_QUIETLY)
 		MESSAGE(STATUS "${PGSQL_DIR_MESSAGE}")
 	ELSE (NOT PGSQL_FIND_QUIETLY)


Some fixes

Some fixes

--- cmake/External.cmake
+++ cmake/External.cmake
@@ -55,21 +55,12 @@
   mark_as_advanced(FORCE FETCHCONTENT_UPDATES_DISCONNECTED_${ucName})

   # Compose arguments for external project
-  set(GEN_ARGS "-G${CMAKE_GENERATOR}")
-  string(FIND "${CMAKE_GENERATOR}" "Visual Studio" IS_VS)
-
-  if("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 16 2019")
-    set(GEN_ARGS "${GEN_ARGS} -Ax64")
-  elseif(${IS_VS} GREATER -1)
-    set(GEN_ARGS "${GEN_ARGS} Win64")
-  endif()
+  set(GEN_ARGS)
+  set(CONF_ARGS)

   if(CMAKE_TOOLCHAIN_FILE)
     set(GEN_ARGS "${GEN_ARGS} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
   endif()
-
-  # Compose configuration arguments
-  set(CONF_ARGS)

   if(args_CMAKE_ARGS)
     set(CONF_ARGS "${args_CMAKE_ARGS}")
@@ -96,7 +87,7 @@
       file(MAKE_DIRECTORY "${${lcName}_BINARY_DIR}/${BUILD_CONFIG}")

       execute_process(
-        COMMAND ${CMAKE_COMMAND} ${GEN_ARGS} ${CONF_ARGS}
+        COMMAND ${CMAKE_COMMAND} "-G${CMAKE_GENERATOR}" "-Ax64" ${GEN_ARGS} ${CONF_ARGS}
           -DCMAKE_INSTALL_PREFIX:PATH=${${lcName}_INSTALL_DIR}/${BUILD_CONFIG}
           -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
           -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -107,7 +98,7 @@
     endforeach()
   else()
     execute_process(
-      COMMAND ${CMAKE_COMMAND} ${GEN_ARGS} ${CONF_ARGS}
+      COMMAND ${CMAKE_COMMAND} "-G${CMAKE_GENERATOR}" "-Ax64" ${GEN_ARGS} ${CONF_ARGS}
         -DCMAKE_INSTALL_PREFIX:PATH=${${lcName}_INSTALL_DIR}
         -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
         -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
@@ -154,7 +145,11 @@
   set_target_properties(${TARGET}_ext PROPERTIES FOLDER external)

   external_set_property(${TARGET} SOURCE_DIR "${${lcName}_SOURCE_DIR}")
-  external_set_property(${TARGET} INSTALL_DIR "${${lcName}_INSTALL_DIR}")
+  if(MULTICONFIG)
+    external_set_property(${TARGET} INSTALL_DIR "${${lcName}_INSTALL_DIR}/Release")
+  else()
+    external_set_property(${TARGET} INSTALL_DIR "${${lcName}_INSTALL_DIR}")
+  endif()
   external_set_property(${TARGET} CONFIG_DIR "${${lcName}_INSTALL_DIR}")
 endfunction(add_external_project)


Fix Ogre dependency lib names.

Fix Ogre dependency lib names.

--- cmake/FindOgre.cmake
+++ cmake/FindOgre.cmake
@@ -22,7 +22,7 @@
       link_directories(${OGRE_LIBRARY_DIR})
   else()
       set (OGRE_LIBRARY_DIR ${ENV_OGRE_HOME}/lib ${ENV_OGRE_HOME}/AndroidDependencies/lib)
-      set (OGRE_LIBRARY OgreOverlayStatic Plugin_OctreeSceneManagerStatic Plugin_ParticleFXStatic RenderSystem_GLES2Static OgreMainStatic FreeImage freetype stdc++ supc++ z zzip cpu-features EGL GLESv1_CM GLESv2 android)
+      set (OGRE_LIBRARY OgreOverlayStatic Plugin_OctreeSceneManagerStatic Plugin_ParticleFXStatic RenderSystem_GLES2Static OgreMainStatic FreeImage freetype stdc++ supc++ z zziplib cpu-features EGL GLESv1_CM GLESv2 android)
       include_directories(${ENV_OGRE_HOME}/include ${ENV_OGRE_HOME}/OgreMain/include ${ENV_OGRE_HOME}/Components/Overlay/include
         ${ENV_OGRE_HOME}/RenderSystems/GLES2/include ${ENV_OGRE_HOME}/PlugIns/OctreeSceneManager/include ${ENV_OGRE_HOME}/PlugIns/ParticleFX/include)
       link_directories(${OGRE_LIBRARY_DIR})


Move global setting into place. (#126)

Move global setting into place. (#126)

--- cmake/bde_ufid.cmake
+++ cmake/bde_ufid.cmake
@@ -173,34 +173,6 @@

     bde_ufid_filter_flags(bde_install_ufid "${ufid_flags}" "${install_ufid_flags}")
     set(bde_install_ufid ${bde_install_ufid} CACHE INTERNAL "" FORCE)
-endfunction()
-
-# :: bde_ufid_add_library ::
-# -----------------------------------------------------------------------------
-function(bde_ufid_add_library name)
-    # Set up shared/static library build
-    if(${bde_ufid_is_shr})
-        set(libType SHARED)
-    else()
-        set(libType STATIC)
-    endif()
-    add_library(${name} ${libType} "${ARGN}")
-endfunction()
-
-# :: bde_ufid_setup_flags ::
-# -----------------------------------------------------------------------------
-function(bde_ufid_setup_flags iface)
-    bde_assert_no_extra_args()
-
-    # Set up PIC
-    # This code does not work in 3.8, but will be fixed in later versions.
-    # The -fPIC flag is set explicitely in the compile options for now.
-    if(${bde_ufid_is_shr} OR ${bde_ufid_is_pic})
-        bde_interface_target_set_property(
-            ${iface}
-                POSITION_INDEPENDENT_CODE PUBLIC 1
-        )
-    endif()

     # Reset global properties to prohibit implicit paths for library lookup and
     # set the global custom lib suffix.
@@ -241,16 +213,35 @@
         set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE STRING "Force c++ standard" FORCE)
         set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard" FORCE)
     endif()
-
-    # Since CMake 3.15 this does not work
-    #bde_interface_target_compile_features(
-    #    ${iface}
-    #    PUBLIC
-    #        $<${bde_ufid_is_cpp03}:cxx_std_98>
-    #        $<${bde_ufid_is_cpp11}:cxx_std_11>
-    #        $<${bde_ufid_is_cpp14}:cxx_std_14>
-    #        $<${bde_ufid_is_cpp17}:cxx_std_17>
-    #)
+endfunction()
+
+# :: bde_ufid_add_library ::
+# -----------------------------------------------------------------------------
+function(bde_ufid_add_library name)
+    # Set up shared/static library build
+    if(${bde_ufid_is_shr})
+        set(libType SHARED)
+    else()
+        set(libType STATIC)
+    endif()
+    add_library(${name} ${libType} "${ARGN}")
+endfunction()
+
+# :: bde_ufid_setup_flags ::
+# -----------------------------------------------------------------------------
+function(bde_ufid_setup_flags iface)
+    bde_assert_no_extra_args()
+
+    # Set up PIC
+    # This code does not work in 3.8, but will be fixed in later versions.
+    # The -fPIC flag is set explicitely in the compile options for now.
+    if(${bde_ufid_is_shr} OR ${bde_ufid_is_pic})
+        bde_interface_target_set_property(
+            ${iface}
+                POSITION_INDEPENDENT_CODE PUBLIC 1
+        )
+    endif()
+

     bde_interface_target_compile_options(
         ${iface}


git-svn-id: https://ricamsvn.ricam.oeaw.ac.at/gismo/stable@4622 e128ff1e-fa79-4151-a8cb-522299a2c450

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -58,6 +58,12 @@
 set(${PROJECT_NAME}_ARCHIVE_OUTPUT_DIRECTORY lib)
 set(${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY bin)
 set(${PROJECT_NAME}_LIBRARY_OUTPUT_DIRECTORY lib)
+foreach(config ${CMAKE_CONFIGURATION_TYPES}) # For Visual studio
+    string(TOUPPER ${config} CONFIG)
+    set(${PROJECT_NAME}_ARCHIVE_OUTPUT_DIRECTORY_${CONFIG} lib)
+    set(${PROJECT_NAME}_RUNTIME_OUTPUT_DIRECTORY_${CONFIG} bin)
+    set(${PROJECT_NAME}_LIBRARY_OUTPUT_DIRECTORY_${CONFIG} lib)
+endforeach()

 #Enable C++ 11
 if(GISMO_BUILD_CPP11 AND UNIX)


[#69] Don't use downloaded clang includes if compiler is clang

--- cmake/libclang.cmake
+++ cmake/libclang.cmake
@@ -147,7 +147,18 @@
         message(FATAL_ERROR "Could not find libclang library at ${llvm_root}/lib")
     endif()
     set(SIPLASPLAS_LIBCLANG_INCLUDE_DIR "${llvm_root}/include")
-    set(SIPLASPLAS_LIBCLANG_SYSTEM_INCLUDE_DIR "${llvm_root}/lib/clang/${SIPLASPLAS_LIBCLANG_VERSION}/include")
+
+    # Use downloaded clang includes only if the compiler
+    # is not a clang, else compilation may fail.
+    # Later libclang_system_include_dir() function guesses
+    # the right path from the clang compiler config
+    if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        message(STATUS "libclang ${SIPLASPLAS_LIBCLANG_VERSION} downloaded, but compiler is ${CMAKE_CXX_COMPILER_ID}")
+        unset(SIPLASPLAS_LIBCLANG_SYSTEM_INCLUDE_DIR)
+    else()
+        message(STATUS "Using downloaded libclang ${SIPLASPLAS_LIBCLANG_VERSION} system includes")
+        set(SIPLASPLAS_LIBCLANG_SYSTEM_INCLUDE_DIR "${llvm_root}/lib/clang/${SIPLASPLAS_LIBCLANG_VERSION}/include")
+    endif()
 else()
     if(NOT SIPLASPLAS_LIBCLANG_LIBRARY)
         if(WIN32)


Upgrade to v0.5.0

Upgrade to v0.5.0

--- cmake/packages.cmake
+++ cmake/packages.cmake
@@ -23,7 +23,7 @@
 endif ()

 set (PACKAGE_NAME        "${CMAKE_PROJECT_NAME}")
-set (PACKAGE_VERSION     "0.4.0.${GIT_CHECKIN_COUNT}")
+set (PACKAGE_VERSION     "0.5.0.${GIT_CHECKIN_COUNT}")
 set (PACKAGE_STRING      "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 set (PACKAGE_TARNAME     "${PACKAGE_NAME}-${PACKAGE_VERSION}")
 set (PACKAGE_BUGREPORT   "https://github.com/Qihoo360/evpp/issues")


Removed unused EXTRA_LIBS.

Removed unused EXTRA_LIBS.

--- cmake/platform.cmake
+++ cmake/platform.cmake
@@ -1,6 +1,4 @@
 include(compilation)
-
-set(EXTRA_LIBS)
 include(deps)

 if (APPLE)


Apply patch from Andreas Beckmann <anbe@debian.org>

Description: report the error code for failed tests

--- cmake/run_test.cmake
+++ cmake/run_test.cmake
@@ -31,7 +31,7 @@

 if( test_not_successful )
-  message( SEND_ERROR "FAIL: Test exited with nonzero code: ${test_cmd_separated}\nSTDOUT:\n${stdout}\nSTDERR:\n${stderr}" )
+  message( SEND_ERROR "FAIL: Test exited with nonzero code (${test_not_successful}): ${test_cmd_separated}\nSTDOUT:\n${stdout}\nSTDERR:\n${stderr}" )
 else()
   message("${stdout}")
   message("${stderr}")


set non-zero M4 RAM only to dualcore devices


Bump robin map version to latest release (#2401)

We were pegged to a fairly old commit. Also, modern versions have
changed their directory layout a bit (tsl/... -> include/tsl/..., so
compensate for that.

--- src/cmake/externalpackages.cmake
+++ src/cmake/externalpackages.cmake
@@ -268,7 +268,7 @@

 option (BUILD_ROBINMAP_FORCE "Force local download/build of robin-map even if installed" OFF)
 option (BUILD_MISSING_ROBINMAP "Local download/build of robin-map if not installed" ON)
-set (BUILD_ROBINMAP_VERSION "1e59f1993c7b6eace15032f38b5acb0bc34f530b" CACHE STRING "Preferred Tessil/robin-map version, of downloading/building our own")
+set (BUILD_ROBINMAP_VERSION "v0.6.2" CACHE STRING "Preferred Tessil/robin-map version, of downloading/building our own")

 macro (find_or_download_robin_map)
     # If we weren't told to force our own download/build of robin-map, look
@@ -285,19 +285,19 @@
         message (STATUS "Downloading local Tessil/robin-map")
         set (ROBINMAP_INSTALL_DIR "${PROJECT_SOURCE_DIR}/ext/robin-map")
         set (ROBINMAP_GIT_REPOSITORY "https://github.com/Tessil/robin-map")
-        if (NOT IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/tsl)
+        if (NOT IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/include/tsl)
             find_package (Git REQUIRED)
             execute_process(COMMAND             ${GIT_EXECUTABLE} clone    ${ROBINMAP_GIT_REPOSITORY} -n ${ROBINMAP_INSTALL_DIR})
             execute_process(COMMAND             ${GIT_EXECUTABLE} checkout ${BUILD_ROBINMAP_VERSION}
                             WORKING_DIRECTORY   ${ROBINMAP_INSTALL_DIR})
-            if (IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/tsl)
+            if (IS_DIRECTORY ${ROBINMAP_INSTALL_DIR}/include/tsl)
                 message (STATUS "DOWNLOADED Tessil/robin-map to ${ROBINMAP_INSTALL_DIR}.\n"
                          "Remove that dir to get rid of it.")
             else ()
                 message (FATAL_ERROR "Could not download Tessil/robin-map")
             endif ()
         endif ()
-        set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}")
+        set (ROBINMAP_INCLUDE_DIR "${ROBINMAP_INSTALL_DIR}/include")
     endif ()
     checked_find_package (Robinmap REQUIRED)
 endmacro()


Remove unused/unneeded OpenGL and GLEW searching from the CMake files


COMP: Always add resources, even if NO_INIT is given.

--- CMake/mitkMacroCreateModule.cmake
+++ CMake/mitkMacroCreateModule.cmake
@@ -247,15 +247,17 @@
           set(_STATIC )
         endif(MODULE_FORCE_STATIC)

-        if(NOT MODULE_NO_INIT AND NOT MODULE_HEADERS_ONLY)
+        if(NOT MODULE_HEADERS_ONLY)
           set(MODULE_LIBNAME ${MODULE_PROVIDES})

-          usFunctionGenerateModuleInit(CPP_FILES
-                                       NAME ${MODULE_NAME}
-                                       LIBRARY_NAME ${MODULE_LIBNAME}
-                                       DEPENDS ${MODULE_DEPENDS} ${MODULE_DEPENDS_INTERNAL} ${MODULE_PACKAGE_DEPENDS}
-                                       #VERSION ${MODULE_VERSION}
-                                      )
+          if(NOT MODULE_NO_INIT)
+            usFunctionGenerateModuleInit(CPP_FILES
+                                         NAME ${MODULE_NAME}
+                                         LIBRARY_NAME ${MODULE_LIBNAME}
+                                         DEPENDS ${MODULE_DEPENDS} ${MODULE_DEPENDS_INTERNAL} ${MODULE_PACKAGE_DEPENDS}
+                                         #VERSION ${MODULE_VERSION}
+                                        )
+          endif()

           if(RESOURCE_FILES)
             set(res_dir Resources)


Removed unnecessary CMAKE_INSTALL_PREFIX

--- cmake/lua.cmake
+++ cmake/lua.cmake
@@ -6,9 +6,9 @@
 # For details see the COPYRIGHT file distributed with LuaDist.
 # Please note that the package source code is licensed under its own license.

-set ( INSTALL_LMOD ${CMAKE_INSTALL_PREFIX}/lib/lua
+set ( INSTALL_LMOD lib/lua
       CACHE PATH "Directory to install Lua modules." )
-set ( INSTALL_CMOD ${CMAKE_INSTALL_PREFIX}/lib/lua
+set ( INSTALL_CMOD lib/lua
       CACHE PATH "Directory to install Lua binary modules." )

 option ( SKIP_LUA_WRAPPER


ManageReleaseFedora: Reviewed

ManageReleaseFedora: Reviewed

--- Modules/ManageReleaseFedora.cmake
+++ Modules/ManageReleaseFedora.cmake
@@ -1,82 +1,112 @@
-# - Module for working with Fedora and EPEL releases.
-#
-# This module provides convenient targets and macros for Fedora and EPEL
-# releases by using fedpkg, koji, and bodhi
+# - Manage Fedora and EPEL releases.
+#
+# This module provides convenient targets and functions for Fedora and
+# EPEL releases with fedpkg, koji, and bodhi.
+#
+# In cmake-fedora, this release steps are:
+#  1. Create SRPM and RPMs
+#  2. Whether SRPM and RPMs pass rpmlint
+#  3. Whether SRPM can be build with koji scratch build
+#  4. Tag the release with PRJ_VER
+#  5. Build SRPM with FedPkg
+#  6. Release to Bodhi
+#
+# Consequently, function RELEASE_FEDORA() should be run after
+# PACK_RPM() and source version control functions like
+# MANAGE_SOURCE_VERSION_CONTROL_GIT().
+#
+# If CMAKE_FEDORA_ENABLE_FEDORA=1, this module will proceed;
+# otherwise, this module is skipped.
 #
 # This module check following files for dependencies:
-#  1. ~/.fedora-upload-ca.cert : Ensure it has certificate file to submit to Fedora.
-#  2. fedpkg : Required to submit to fedora.
-#  3. koji : Required to submit to fedora.
-#  4. bodhi : Required to submit to fedora.
-#
-#  If on of above file is missing, this module will be skipped.
-#
-# This module read the supported release information from cmake-fedora.conf
-# It finds cmake-fedora.conf in following order:
-# 1. Current directory
-# 2. Path as defined CMAKE_SOURCE_DIR
-# 3. /etc/cmake-fedora.conf
-#
-# Includes:
-#   ManageFile
-#   ManageMessage
-#   ManageTarget
+#   - ~/.fedora-upload-ca.cert : Ensure it has certificate file to
+#     submit to Fedora.
+#   - fedpkg : Required to submit to fedora.
+#   - koji : Required to submit to fedora.
+#   - bodhi : Required to submit to fedora.
+# If any of above files are missing, this module will be skipped.
+#
+# This module read the supported release information from
+# cmake-fedora.conf, it finds cmake-fedora.conf in following order:
+#  1. Current directory
+#  2. Path as defined CMAKE_SOURCE_DIR
+#  3. /etc/cmake-fedora.conf
+#
+# Included Modules:
+#   - ManageFile
+#   - ManageMessage
+#   - ManageTarget
+#   - ManageRPM
+#   - ManageVariable
+#
+# Reads following variables:
+#   - CMAKE_FEDORA_TMP_DIR
+#   - PRJ_SRPM_FILE: Project
 #
 # Defines following variables:
-#    CMAKE_FEDORA_CONF: Path to cmake_fedora.conf
-#    FEDPKG_CMD: Path to fedpkg
-#    KOJI_CMD: Path to koji
-#    GIT_CMD: Path to git
-#    BODHI_CMD: Path to bodhi
-#    KOJI_BUILD_SCRATCH_CMD: Path to koji-build-scratch
-#    FEDPKG_DIR: Dir for FedPkg. It will use environment variable
-#                FEDPKG_DIR, then use $CMAKE_BINARY_DIR/FedPkg.
-#    FEDORA_KAMA: Fedora Karma. Default:3
-#    FEDORA_UNSTABLE_KARMA: Fedora unstable Karma. Default:3
-#    FEDORA_AUTO_KARMA: Whether to use fedora Karma system. Default:"True"
+#   - CMAKE_FEDORA_CONF: Path to cmake_fedora.conf
+#   - FEDPKG_CMD: Path to fedpkg
+#   - KOJI_CMD: Path to koji
+#   - GIT_CMD: Path to git
+#   - BODHI_CMD: Path to bodhi
+#   - KOJI_BUILD_SCRATCH_CMD: Path to koji-build-scratch
+#   - FEDPKG_DIR: Dir for FedPkg checkout.
+#       It will use environment variable FEDPKG_DIR, then use
+#       ${CMAKE_FEDORA_TMP_DIR}/FedPkg.
+#   - FEDORA_KAMA: Fedora Karma. Default:3
+#   - FEDORA_UNSTABLE_KARMA: Fedora unstable Karma. Default:3
 #
 # Defines following functions:
-#   RELEASE_FEDORA([scopeList])
-#   - Release this project to specified Fedora and EPEL releases.
-#     Arguments:
-#     + scopeList: List of Fedora and EPEL release to be build.
-#       Valid values:
-#       - rawhide: Build rawhide.
-#       - fedora: Build actives fedora releases, including Rawhide.
-#       - fedora_1: Build the latest supported fedora releases.
-#         This is one release eariler than rawhide.
-#       - fedora_2: Build the second latest supported fedora releases.
-#         This is two releases eariler than rawhide.
-#       - f22 f21 ...: Build the specified fedora releases.
-#       - epel: Build the currently supported EPEL releases.
-#       - epel_1: Build the latest supported EPEL releases.
-#       - epel_2: Build the second latest supported EPEL releases.
-#       - el7 el6 ... : The EPEL releases to be built.
-#       If not specified, "fedora epel" will be used.
-#
-#     Reads following variables:
-#     + PRJ_SRPM_FILE: Project SRPM
-#     + FEDPKG_DIR: Directory for fedpkg checkout.
-#       Default: Environment variable FEDPKG_DIR,
-#                then $CMAKE_BINARY_DIR/FedPkg.
-#     Reads and define following variables:
-#     + FEDORA_RAWHIDE_VER: Numeric version of rawhide, such as 18
-#     + FEDORA_SUPPORTED_VERS: Numeric versions of currently supported Fedora,
-#       such as 17;16
-#     + EPEL_SUPPORTED_VERS: Numeric versions of currently supported EPEL
-#       since version 5. Such as 6;5
-#     + FEDORA_KARMA: Karma for auto pushing.
-#       Default: 3
-#     + FEDORA_UNSTABLE_KARMA: Karma for auto unpushing.
-#       Default: 3
-#     Defines following targets:
-#     + release_fedora: Make necessary steps for releasing on fedora,
-#       such as making source file tarballs, source rpms, build with fedpkg
-#       and upload to bodhi.
-#     + koji_build_scratch: Scratch build using koji
-#
-#
-
+#   RELEASE_FEDORA([<scope> ...]
+#       [DEPENDS <dependFile> ...]
+#       [TARGETS <target> ...]
+#     )
+#     - Release this project to specified Fedora and EPEL releases.
+#       * Parameters:
+#         + scope ...: List of Fedora and EPEL release to be build.
+#           Valid values:
+#           - rawhide: Build rawhide.
+#           - fedora: Build actives fedora releases, including Rawhide.
+#           - fedora_1: Build the latest supported fedora releases.
+#             This is one release eariler than rawhide.
+#           - fedora_2: Build the second latest supported fedora releases.
+#             This is two releases eariler than rawhide.
+#           - f22 f21 ...: Build the specified fedora releases.
+#           - epel: Build the currently supported EPEL releases.
+#           - epel_1: Build the latest supported EPEL releases.
+#           - epel_2: Build the second latest supported EPEL releases.
+#           - el7 el6 ... : The EPEL releases to be built.
+#           If not specified, "fedora epel" will be used.
+#         + DEPENDS dependFile ...: Files that target "release-fedora"
+#             depends on.
+#         + TARGETS target ...: Targets that target "release-fedora"
+#             depends on.
+#             Note that if a target does not exist, a M_ERROR message
+#             will be shown.
+#
+#       * Reads following variables:
+#         + PRJ_SRPM_FILE: Project SRPM
+#         + FEDPKG_DIR: Directory for fedpkg checkout.
+#         + MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE:
+#           Version tag file used in source version control.
+#       * Defines following targets:
+#         + fedpkg_build: Build with fedpkg and push to bodhi.
+#            This depends on the tag file from source control
+#            (i.e. MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE)
+#         + koji_build_scratch: Scratch build using koji.
+#            This depends on target "rpmlint".
+#            Target "tag_pre" should be dependent on this target.
+#            A M_ERROR message will shown if target "tag_pre" does not
+#            exist.
+#         + release_fedora: Releases on fedora and/or EPEL.
+#            This depends on target "fedpkg_build".
+#            After this target is built, release on Fedora should be
+#            completed.
+#
+
+IF(NOT CMAKE_FEDORA_ENABLE_FEDORA_BUILD)
+    RETURN()
+ENDIF(NOT CMAKE_FEDORA_ENABLE_FEDORA_BUILD)
 IF(DEFINED _MANAGE_RELEASE_FEDORA_)
     RETURN()
 ENDIF(DEFINED _MANAGE_RELEASE_FEDORA_)
@@ -85,6 +115,7 @@
 INCLUDE(ManageFile)
 INCLUDE(ManageTarget)
 INCLUDE(ManageRPM)
+INCLUDE(ManageVariable)
 SET(_manage_release_fedora_dependencies_missing 0)

 MANAGE_CMAKE_FEDORA_CONF(CMAKE_FEDORA_CONF
@@ -102,6 +133,8 @@
 	)
 ENDMACRO(RELEASE_FEDORA_FIND_DEPENDENCY var)

+RELEASE_FEDORA_FIND_DEPENDENCY(FEDORA_UPLOAD_CA_CERT
+    .fedora-upload-ca.cert PATHS $ENV{HOME})
 RELEASE_FEDORA_FIND_DEPENDENCY(FEDPKG_CMD fedpkg)
 RELEASE_FEDORA_FIND_DEPENDENCY(KOJI_CMD koji)
 RELEASE_FEDORA_FIND_DEPENDENCY(GIT_CMD git)
@@ -114,70 +147,103 @@
    PATHS ${CMAKE_FEDORA_ADDITIONAL_SCRIPT_PATH})

 ## Set variables
-IF(NOT _manage_release_fedora_dependencies_missing)
-    # Set release tags according to CMAKE_FEDORA_CONF
-    SETTING_FILE_GET_ALL_VARIABLES(${CMAKE_FEDORA_CONF})
-
-    SET(BODHI_TEMPLATE_FILE "${CMAKE_FEDORA_TMP_DIR}/bodhi.template"
-	CACHE FILEPATH "Bodhi template file"
-	)
-
-    GET_ENV(FEDPKG_DIR "${CMAKE_FEDORA_TMP_DIR}/FedPkg" CACHE PATH "FedPkg dir")
-
-    ## Fedora package variables
-    SET(FEDORA_KARMA "3" CACHE STRING "Fedora Karma")
-    SET(FEDORA_UNSTABLE_KARMA "-3" CACHE STRING "Fedora unstable Karma")
-ENDIF(NOT _manage_release_fedora_dependencies_missing)
+IF(_manage_release_fedora_dependencies_missing)
+    RETURN()
+ENDIF(_manage_release_fedora_dependencies_missing)
+# Set release tags according to CMAKE_FEDORA_CONF
+SETTING_FILE_GET_ALL_VARIABLES(${CMAKE_FEDORA_CONF})
+
+SET(BODHI_TEMPLATE_FILE "${CMAKE_FEDORA_TMP_DIR}/bodhi.template"
+    CACHE FILEPATH "Bodhi template file"
+    )
+
+GET_ENV(FEDPKG_DIR "${CMAKE_FEDORA_TMP_DIR}/FedPkg" CACHE PATH "FedPkg dir")
+
+## Fedora package variables
+SET(FEDORA_KARMA "3" CACHE STRING "Fedora Karma")
+SET(FEDORA_UNSTABLE_KARMA "-3" CACHE STRING "Fedora unstable Karma")

 FUNCTION(RELEASE_FEDORA_KOJI_BUILD_SCRATCH)
-    IF(NOT _manage_release_fedora_dependencies_missing)
-	ADD_CUSTOM_TARGET(koji_build_scratch
-	    COMMAND ${KOJI_BUILD_SCRATCH_CMD} ${PRJ_SRPM_FILE} ${ARGN}
-	    DEPENDS "${PRJ_SRPM_FILE}"
-	    COMMENT "koji scratch build on ${PRJ_SRPM_FILE}"
-	    VERBATIM
-	    )
-    ENDIF(NOT _manage_release_fedora_dependencies_missing)
+    IF(_manage_release_fedora_dependencies_missing)
+	RETURN()
+    ENDIF(_manage_release_fedora_dependencies_missing)
+    ADD_CUSTOM_TARGET(koji_build_scratch
+	COMMAND ${KOJI_BUILD_SCRATCH_CMD} ${PRJ_SRPM_FILE} ${ARGN}
+	DEPENDS "${PRJ_SRPM_FILE}"
+	COMMENT "koji_build_scratch: SRPM=${PRJ_SRPM_FILE}"
+	VERBATIM
+	)
     ADD_DEPENDENCIES(koji_build_scratch rpmlint)
-    ADD_DEPENDENCIES(tag_pre koji_build_scratch)
+    IF(TARGET tag_pre)
+	ADD_DEPENDENCIES(tag_pre koji_build_scratch)
+    ELSE(TARGET tag_pre)
+	M_MSG(${M_ERROR}
+	    "RELEASE_FEDORA: Target tag_pre does not exist.")
+    ENDIF(TARGET tag_pre)
 ENDFUNCTION(RELEASE_FEDORA_KOJI_BUILD_SCRATCH)

 FUNCTION(RELEASE_FEDORA_FEDPKG)
-    IF(NOT _manage_release_fedora_dependencies_missing)
-	IF(NOT DEFINED MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE)
-	    M_MSG(${M_ERROR} "Undefined MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE, please use MANAGE_SOURCE_VERSION_CONTROL_GIT or other source version control")
-	ENDIF(NOT DEFINED MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE)
-	M_MSG(${M_INFO2}
-	    "MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE=${MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE}")
-	SET(_cmdOpts "")
-	IF (NOT "${CHANGE_SUMMARY}" STREQUAL "")
-	    SET(CHANGE_SUMMARY "Release ${PROJECT_NAME}-${PRJ_VER}")
-	ENDIF(NOT "${CHANGE_SUMMARY}" STREQUAL "")
-
-	IF (NOT REDHAT_BUGZILLA STREQUAL "")
-	    LIST(APPEND _cmdOpts "-b" "${REDHAT_BUGZILLA}")
-	ENDIF(NOT REDHAT_BUGZILLA STREQUAL "")
-
-	ADD_CUSTOM_TARGET(fedpkg_build
-	    COMMAND ${CMAKE_FEDORA_FEDPKG_CMD} -d "${FEDPKG_DIR}"
-	    -m "${CHANGE_SUMMARY}"
-	    ${_cmdOpts} "${PRJ_SRPM_FILE}" ${ARGN}
-	    DEPENDS "${MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE}"
-	    VERBATIM
-	    )
-
-    ENDIF(NOT _manage_release_fedora_dependencies_missing)
+    IF(_manage_release_fedora_dependencies_missing)
+	RETURN()
+    ENDIF(_manage_release_fedora_dependencies_missing)
+    IF(MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE STREQUAL "")
+	M_MSG(${M_ERROR} "RELEASE_FEDORA_FEDPKG: Undefined
+MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE, please use MANAGE_SOURCE_VERSION_CONTROL_GIT() or other source version control functions")
+    ENDIF(MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE STREQUAL "")
+    M_MSG(${M_INFO2} 	"MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE=${MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE}")
+    SET(_cmdOpts "")
+    IF ("${CHANGE_SUMMARY}" STREQUAL "")
+	SET(CHANGE_SUMMARY "Release ${PROJECT_NAME}-${PRJ_VER}")
+    ENDIF("${CHANGE_SUMMARY}" STREQUAL "")
+
+    IF (NOT REDHAT_BUGZILLA STREQUAL "")
+	LIST(APPEND _cmdOpts "-b" "${REDHAT_BUGZILLA}")
+    ENDIF(NOT REDHAT_BUGZILLA STREQUAL "")
+
+    ADD_CUSTOM_TARGET(fedpkg_build
+	COMMAND ${CMAKE_FEDORA_FEDPKG_CMD} -d "${FEDPKG_DIR}"
+	-m "${CHANGE_SUMMARY}"
+	${_cmdOpts} "${PRJ_SRPM_FILE}" ${ARGN}
+	DEPENDS "${MANAGE_SOURCE_VERSION_CONTROL_TAG_FILE}"
+	VERBATIM
+	)
 ENDFUNCTION(RELEASE_FEDORA_FEDPKG)

 FUNCTION(RELEASE_FEDORA)
-    IF(NOT _manage_release_fedora_dependencies_missing)
-	## Parse tags
-	SET(_scope_list ${ARGN})
-	RELEASE_FEDORA_KOJI_BUILD_SCRATCH(${_scope_list})
-	RELEASE_FEDORA_FEDPKG(${_scope_list})
-	ADD_CUSTOM_TARGET(release_fedora
-	    COMMENT "Release for Fedora")
-	ADD_DEPENDENCIES(release_fedora fedpkg_build)
-    ENDIF(NOT _manage_release_fedora_dependencies_missing)
+    IF(_manage_release_fedora_dependencies_missing)
+	RETURN()
+    ENDIF(_manage_release_fedora_dependencies_missing)
+
+    ## Parse tags
+    SET(_validOptions "DEPENDS" "TARGETS")
+    VARIABLE_PARSE_ARGN(_o _validOptions ${ARGN})
+    SET(_releaseDependOptList "")
+
+    IF(NOT "${_o_DEPENDS}" STREQUAL "")
+	SET(_releaseDependOptList DEPENDS ${_o_DEPENDS})
+    ENDIF(NOT "${_o_DEPENDS}" STREQUAL "")
+
+    SET(_scopeList ${_o})
+    RELEASE_FEDORA_KOJI_BUILD_SCRATCH(${_scopeList})
+    RELEASE_FEDORA_FEDPKG(${_scopeList})
+    ADD_CUSTOM_TARGET(release_fedora
+	${_releaseDependOptList}
+	COMMENT "release_fedora: ${_scopeList}"
+	)
+    ADD_DEPENDENCIES(release_fedora fedpkg_build)
+
+    ## Add dependent targets that actually exists
+    SET(_releaseTargets "")
+    FOREACH(_target ${_o_TARGETS})
+	IF(TARGET ${_target})
+	    LIST(APPEND _releaseTargets "${_target}")
+	    ## Release targets should be build after target tag
+	    ADD_DEPENDENCIES(${_target} tag)
+	    ADD_DEPENDENCIES(release_fedora ${_target})
+	ELSE(TARGET ${_target})
+	    M_MSG(${M_ERROR}
+		"RELEASE_FEDORA: Target ${_target} does not exist.")
+	ENDIF(TARGET ${_target})
+    ENDFOREACH(_target)
 ENDFUNCTION(RELEASE_FEDORA)


make STIR depend on SWIG if BUILD_STIR_SWIG_PYTHON=On

Closes #130

--- SuperBuild/External_STIR.cmake
+++ SuperBuild/External_STIR.cmake
@@ -28,7 +28,10 @@
 else()
   set(${proj}_DEPENDENCIES "Boost")
 endif()
-
+if (BUILD_STIR_SWIG_PYTHON)
+  list(APPEND ${proj}_DEPENDENCIES "SWIG")
+endif()
+
 # Include dependent projects if any
 ExternalProject_Include_Dependencies(${proj} DEPENDS_VAR ${proj}_DEPENDENCIES)


Removing emitc usage of IREE_COMMON_INCLUDE_DIRS for now.

--- build_tools/cmake/iree_copts.cmake
+++ build_tools/cmake/iree_copts.cmake
@@ -466,10 +466,11 @@
   set(EMITC_ENABLE_HLO OFF)
   set(EMITC_INCLUDE_TESTS OFF)

-  list(APPEND IREE_COMMON_INCLUDE_DIRS
-    ${CMAKE_CURRENT_SOURCE_DIR}/third_party/mlir-emitc/include
-    ${CMAKE_CURRENT_BINARY_DIR}/third_party/mlir-emitc/include
-  )
+  # TODO(marbre): add these only where required, not globally.
+  # list(APPEND IREE_COMMON_INCLUDE_DIRS
+  #   ${CMAKE_CURRENT_SOURCE_DIR}/third_party/mlir-emitc/include
+  #   ${CMAKE_CURRENT_BINARY_DIR}/third_party/mlir-emitc/include
+  # )
   add_definitions(-DIREE_HAVE_EMITC_DIALECT)
 endif()


Extend IREE_COMMON_INCLUDE_DIRS for external dialects (#2855)

Required to bump the IREE submodule used in
https://github.com/iml130/iree-template-cpp. TensorFlow is otherwise
unable to find tablegenerated files.

--- build_tools/cmake/iree_copts.cmake
+++ build_tools/cmake/iree_copts.cmake
@@ -249,6 +249,8 @@
   ${PROJECT_SOURCE_DIR}/third_party/tensorflow/tensorflow/compiler/mlir/hlo/include/
   ${PROJECT_BINARY_DIR}/build_tools/third_party/tensorflow
   ${PROJECT_BINARY_DIR}/build_tools/third_party/tensorflow/tensorflow/compiler/mlir/hlo/include/
+  ${PROJECT_BINARY_DIR}/build_tools/third_party/tensorflow/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/IR/
+  ${PROJECT_BINARY_DIR}/build_tools/third_party/tensorflow/tensorflow/compiler/mlir/hlo/lib/Dialect/mhlo/transforms
 )

 #-------------------------------------------------------------------------------


cmake-rust: merge two RustStaticLibrary.cmake and add feature support

Summary:
We somehow have two different RustStaticLibrary.cmake in different places (one in eden repo and the other one in the shared opensource builder).

This diff merges them and switches Eden into using the shared CMake function (for the features option).

This diff also adds the features option for rust_executable funciton, which will be used in the next diff.

Reviewed By: kmancini

Differential Revision: D39038491

fbshipit-source-id: 99d61a1d5450010b345107a9ec5c761b62004aa6

--- build/fbcode_builder/CMake/RustStaticLibrary.cmake
+++ build/fbcode_builder/CMake/RustStaticLibrary.cmake
@@ -1,4 +1,4 @@
-# Copyright (c) Facebook, Inc. and its affiliates.
+# Copyright (c) Meta Platforms, Inc. and affiliates.

 include(FBCMakeParseArgs)

@@ -26,7 +26,7 @@

 if("${GENERATE_CARGO_VENDOR_CONFIG}" STREQUAL "AUTO")
   set(GENERATE_CARGO_VENDOR_CONFIG "${USE_CARGO_VENDOR}")
-endif()
+endif()

 if(GENERATE_CARGO_VENDOR_CONFIG)
   if(NOT EXISTS "${RUST_VENDORED_CRATES_DIR}")
@@ -78,7 +78,7 @@
 # Cargo build static library.
 #
 # ```cmake
-# rust_static_library(<TARGET> [CRATE <CRATE_NAME>])
+# rust_static_library(<TARGET> [CRATE <CRATE_NAME>] [FEATURES <FEATURE_NAME>])
 # ```
 #
 # Parameters:
@@ -88,6 +88,8 @@
 # - CRATE_NAME:
 #   Name of the crate. This parameter is optional. If unspecified, it will
 #   fallback to `${TARGET}`.
+# - FEATURE_NAME:
+#   Name of the Rust feature to enable.
 #
 # This function creates two targets:
 # - "${TARGET}": an interface library target contains the static library built
@@ -99,12 +101,17 @@
 # headers with the interface library.
 #
 function(rust_static_library TARGET)
-  fb_cmake_parse_args(ARG "" "CRATE" "" "${ARGN}")
+  fb_cmake_parse_args(ARG "" "CRATE;FEATURES" "" "${ARGN}")

   if(DEFINED ARG_CRATE)
     set(crate_name "${ARG_CRATE}")
   else()
     set(crate_name "${TARGET}")
+  endif()
+  if(DEFINED ARG_FEATURES)
+    set(features --features ${ARG_FEATURES})
+  else()
+    set(features )
   endif()

   set(cargo_target "${TARGET}.cargo")
@@ -117,7 +124,11 @@
     set(cargo_cmd cargo.exe)
   endif()

-  set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name})
+  if(DEFINED ARG_FEATURES)
+    set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name} --features ${ARG_FEATURES})
+  else()
+    set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name})
+  endif()
   if(USE_CARGO_VENDOR)
     set(extra_cargo_env "CARGO_HOME=${RUST_CARGO_HOME}")
     set(cargo_flags ${cargo_flags})
@@ -156,16 +167,18 @@
   )
 endfunction()

-# This function instructs cmake to define a target that will use `cargo build`
+# This function instructs CMake to define a target that will use `cargo build`
 # to build a bin crate referenced by the Cargo.toml file in the current source
 # directory.
 # It accepts a single `TARGET` parameter which will be passed as the package
 # name to `cargo build -p TARGET`. If binary has different name as package,
 # use optional flag BINARY_NAME to override it.
-# The cmake target will be registered to build by default as part of the
+# It also accepts a `FEATURES` parameter if you want to enable certain features
+# in your Rust binary.
+# The CMake target will be registered to build by default as part of the
 # ALL target.
 function(rust_executable TARGET)
-  fb_cmake_parse_args(ARG "" "BINARY_NAME" "" "${ARGN}")
+  fb_cmake_parse_args(ARG "" "BINARY_NAME;FEATURES" "" "${ARGN}")

   set(crate_name "${TARGET}")
   set(cargo_target "${TARGET}.cargo")
@@ -174,7 +187,12 @@
   if(DEFINED ARG_BINARY_NAME)
     set(executable_name "${ARG_BINARY_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
   else()
-      set(executable_name "${crate_name}${CMAKE_EXECUTABLE_SUFFIX}")
+    set(executable_name "${crate_name}${CMAKE_EXECUTABLE_SUFFIX}")
+  endif()
+  if(DEFINED ARG_FEATURES)
+    set(features --features ${ARG_FEATURES})
+  else()
+    set(features )
   endif()

   set(cargo_cmd cargo)
@@ -182,7 +200,11 @@
     set(cargo_cmd cargo.exe)
   endif()

-  set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name})
+  if(DEFINED ARG_FEATURES)
+    set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name} --features ${ARG_FEATURES})
+  else()
+    set(cargo_flags build $<IF:$<CONFIG:Debug>,,--release> -p ${crate_name})
+  endif()
   if(USE_CARGO_VENDOR)
     set(extra_cargo_env "CARGO_HOME=${RUST_CARGO_HOME}")
     set(cargo_flags ${cargo_flags})


Re-add expat to the link line.

Re-add expat to the link line.

This is necessary for the UW builds. Condor doesn't depend on expat, but
voms does. Without this change, if UW Condor is installed on a system
that doesn't have expat installed, the Condor binaries won't run.

--- build/cmake/CondorConfigure.cmake
+++ build/cmake/CondorConfigure.cmake
@@ -640,8 +640,8 @@
 ###########################################
 # order of the below elements is important, do not touch unless you know what you are doing.
 # otherwise you will break due to stub collisions.
-set (CONDOR_LIBS "condor_utils;${CLASSADS_FOUND};${VOMS_FOUND};${GLOBUS_FOUND};${PCRE_FOUND};${COREDUMPER_FOUND}")
-set (CONDOR_TOOL_LIBS "condor_utils;${CLASSADS_FOUND};${VOMS_FOUND};${GLOBUS_FOUND};${PCRE_FOUND};${COREDUMPER_FOUND}")
+set (CONDOR_LIBS "condor_utils;${CLASSADS_FOUND};${VOMS_FOUND};${GLOBUS_FOUND};${EXPAT_FOUND};${PCRE_FOUND};${COREDUMPER_FOUND}")
+set (CONDOR_TOOL_LIBS "condor_utils;${CLASSADS_FOUND};${VOMS_FOUND};${GLOBUS_FOUND};${EXPAT_FOUND};${PCRE_FOUND};${COREDUMPER_FOUND}")
 set (CONDOR_SCRIPT_PERMS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

 message(STATUS "----- Begin compiler options/flags check -----")


fix cmake   * enable fp16 feature correctly with gcc on x86/x86_64

--- cmake/OpenCVCompilerOptions.cmake
+++ cmake/OpenCVCompilerOptions.cmake
@@ -170,9 +170,6 @@
         add_extra_compiler_option(-mfma)
       endif()
     endif()
-    if((X86 OR X86_64) AND NOT MSVC)
-        add_extra_compiler_option(-mf16c)
-    endif((X86 OR X86_64) AND NOT MSVC)

     # GCC depresses SSEx instructions when -mavx is used. Instead, it generates new AVX instructions or AVX equivalence for all SSEx instructions when needed.
     if(NOT OPENCV_EXTRA_CXX_FLAGS MATCHES "-mavx")
@@ -204,6 +201,9 @@
         add_extra_compiler_option(-mpopcnt)
       endif()
     endif()
+    if((X86 OR X86_64) AND NOT MSVC)
+        add_extra_compiler_option(-mf16c)
+    endif((X86 OR X86_64) AND NOT MSVC)
   endif(NOT MINGW)

   if(X86 OR X86_64)


Respect value of BUILD_SHARED_LIBS in ROOT_LINKER_LIBRARY

--- cmake/modules/RootNewMacros.cmake
+++ cmake/modules/RootNewMacros.cmake
@@ -602,7 +602,7 @@
 function(ROOT_LINKER_LIBRARY library)
   CMAKE_PARSE_ARGUMENTS(ARG "DLLEXPORT;CMAKENOEXPORT;TEST;NOINSTALL" "TYPE" "LIBRARIES;DEPENDENCIES;BUILTINS"  ${ARGN})
   ROOT_GET_SOURCES(lib_srcs src ${ARG_UNPARSED_ARGUMENTS})
-  if(NOT ARG_TYPE)
+  if(NOT ARG_TYPE AND BUILD_SHARED_LIBS)
     set(ARG_TYPE SHARED)
   endif()
   if(ARG_TEST) # we are building a test, so add EXCLUDE_FROM_ALL


Add api-ms-win-core-com-l1-1-0.dll, shlwapi.dll, oleaut32.dll to delay load (#9619)

--- cmake/onnxruntime_providers.cmake
+++ cmake/onnxruntime_providers.cmake
@@ -917,7 +917,7 @@
     target_link_libraries(onnxruntime_providers_dml PRIVATE delayimp.lib)
   endif()

-  set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:DirectML.dll /DELAYLOAD:d3d12.dll /DELAYLOAD:dxgi.dll /ignore:4199")
+  set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:DirectML.dll /DELAYLOAD:d3d12.dll /DELAYLOAD:dxgi.dll /DELAYLOAD:api-ms-win-core-com-l1-1-0.dll /DELAYLOAD:shlwapi.dll /DELAYLOAD:oleaut32.dll /ignore:4199")

   target_compile_definitions(onnxruntime_providers_dml PRIVATE ONNX_NAMESPACE=onnx ONNX_ML LOTUS_LOG_THRESHOLD=2 LOTUS_ENABLE_STDERR_LOGGING PLATFORM_WINDOWS)
   target_compile_definitions(onnxruntime_providers_dml PRIVATE UNICODE _UNICODE NOMINMAX)


Add BMI include dirs back for travis testing

--- Testing/script/travis_script.cmake
+++ Testing/script/travis_script.cmake
@@ -143,6 +143,8 @@
 MERCURY_USE_SELF_FORWARD:BOOL=ON
 MERCURY_USE_XDR:BOOL=OFF
 NA_USE_BMI:BOOL=${USE_BMI}
+BMI_INCLUDE_DIR:PATH=$ENV{HOME}/install/include
+BMI_LIBRARY:FILEPATH=$ENV{HOME}/install/lib/libbmi.${SOEXT}
 NA_BMI_TESTING_PROTOCOL:STRING=tcp
 NA_USE_MPI:BOOL=ON
 NA_USE_CCI:BOOL=${USE_CCI}


- More fixes to OSX build scripts

- More fixes to OSX build scripts

--- cmake/Modules/BuildFunctions.cmake
+++ cmake/Modules/BuildFunctions.cmake
@@ -30,7 +30,7 @@
     target_enable_cxx11(${TARGET})

     if(APPLE)
-        set_target_properties( ${TARGET} MACOSX_RPATH "." )
+        set_target_properties( ${TARGET} PROPERTIES MACOSX_RPATH "." )
     endif()

     install(


[DOC] Typo in Visual Studio version number

--- util/cmake/FindSeqAn.cmake
+++ util/cmake/FindSeqAn.cmake
@@ -186,7 +186,7 @@

     # require at least MSVC 19.0
     if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19.0")
-        message(FATAL_ERROR "MSVC version (${CMAKE_CXX_COMPILER_VERSION}) must be at least 19.0 (Visual Studio 2016)!")
+        message(FATAL_ERROR "MSVC version (${CMAKE_CXX_COMPILER_VERSION}) must be at least 19.0 (Visual Studio 2015)!")
     endif()

 else()


Fix missing option initialization in toolchain

--- toolchain.cmake
+++ toolchain.cmake
@@ -69,13 +69,13 @@

 endif( ${PARALLAX_P8X32A_LOADER_ENABLE_EEPROM_WRITE} )

-option( PARALLAX_P8X32A_LOADER_ENABLE_QUIT "Parallax P8X32A loader quit on exit sequence" )
+option( PARALLAX_P8X32A_LOADER_ENABLE_QUIT "Parallax P8X32A loader quit on exit sequence" OFF )
 if( ${PARALLAX_P8X32A_LOADER_ENABLE_QUIT} )
     set( PARALLAX_P8X32A_LOADER_QUIT "QUIT" )

 endif( ${PARALLAX_P8X32A_LOADER_ENABLE_QUIT} )

-option( PARALLAX_P8X32A_LOADER_ENABLE_VERBOSE "Parallax P8X32A loader verbose output" )
+option( PARALLAX_P8X32A_LOADER_ENABLE_VERBOSE "Parallax P8X32A loader verbose output" OFF )
 if( ${PARALLAX_P8X32A_LOADER_ENABLE_VERBOSE} )
     set( PARALLAX_P8X32A_LOADER_VERBOSE "VERBOSE" )


v2x: adding update_golden command in v2x cmake

Signed-off-by: Alessandro Comodi <622632e70fd6771cf2cd943f69e5e51ab66adef8@antmicro.com>

--- utils/vlog/tests/v2x_tests.cmake
+++ utils/vlog/tests/v2x_tests.cmake
@@ -5,7 +5,6 @@
   # ~~~
   # V2X_GENERIC_TEST(
   #   NAME name
-  #   TOP_MODULE name
   #   TYPE pb_type | model
   #   )
   # ~~~
@@ -15,14 +14,13 @@
   # Therefore, this function is used to generalize and perform the desired test.
   #
   # NAME name of the test.
-  # TOP_MODULE name of the top verilog module that has to be tested.
   # TYPE type of test that has to be performed (model or pb_type generation).
   #
   # In addition it adds the newly created target to the `all_v2x_tests` dependencies. (all tests will be performed with `make all_v2x_tests`)
   #
-  # Usage: v2x_generic_test(NAME <test_name> TOP_MODULE <top_module.v> TYPE <model|pb_type>) (All fields are required)
+  # Usage: v2x_generic_test(NAME <test_name> TYPE <model|pb_type>) (All fields are required)

-  set(oneValueArgs NAME TOP_MODULE TYPE)
+  set(oneValueArgs NAME TYPE)
   cmake_parse_arguments(
     V2X_GENERIC_TEST
     "${options}"
@@ -31,21 +29,28 @@
     ${ARGN}
   )

+  set(TYPE ${V2X_GENERIC_TEST_TYPE})
+  set(NAME ${V2X_GENERIC_TEST_NAME})

   # pb_type checking
-  set(V2X_GENERIC_TEST_GOLDEN_XML golden.${V2X_GENERIC_TEST_TYPE}.xml)
-  add_file_target(FILE ${V2X_GENERIC_TEST_GOLDEN_XML} SCANNER_TYPE xml)
-  xml_sort(NAME ${V2X_GENERIC_TEST_NAME}_${V2X_GENERIC_TEST_TYPE}_golden_sort FILE ${V2X_GENERIC_TEST_GOLDEN_XML} OUTPUT ${V2X_GENERIC_TEST_NAME}.${V2X_GENERIC_TEST_TYPE}.golden.xml)
+  set(GOLDEN_XML golden.${TYPE}.xml)
+  add_file_target(FILE ${GOLDEN_XML} SCANNER_TYPE xml)
+  xml_sort(NAME ${NAME}_${TYPE}_golden_sort FILE ${GOLDEN_XML} OUTPUT ${NAME}.${TYPE}.golden.xml)

-  set(V2X_GENERIC_TEST_ACTUAL_XML ${V2X_GENERIC_TEST_NAME}.${V2X_GENERIC_TEST_TYPE}.xml)
-  xml_sort(NAME ${V2X_GENERIC_TEST_NAME}_${V2X_GENERIC_TEST_TYPE}_actual_sort FILE ${V2X_GENERIC_TEST_ACTUAL_XML} OUTPUT ${V2X_GENERIC_TEST_NAME}.${V2X_GENERIC_TEST_TYPE}.actual.xml)
+  set(ACTUAL_XML ${NAME}.${TYPE}.xml)
+  xml_sort(NAME ${NAME}_${TYPE}_actual_sort FILE ${ACTUAL_XML} OUTPUT ${NAME}.${TYPE}.actual.xml)

-  diff(NAME ${V2X_GENERIC_TEST_NAME}_${V2X_GENERIC_TEST_TYPE}_diff GOLDEN ${V2X_GENERIC_TEST_NAME}.${V2X_GENERIC_TEST_TYPE}.golden.xml ACTUAL ${V2X_GENERIC_TEST_NAME}.${V2X_GENERIC_TEST_TYPE}.actual.xml)
+  diff(NAME ${NAME}_${TYPE}_diff GOLDEN ${NAME}.${TYPE}.golden.xml ACTUAL ${NAME}.${TYPE}.actual.xml)

-  add_dependencies(all_v2x_tests ${V2X_GENERIC_TEST_NAME}_${V2X_GENERIC_TEST_TYPE}_diff)
+  add_dependencies(all_v2x_tests ${NAME}_${TYPE}_diff)

   # TODO This has to be completed in order update the golden pb_type/model accordingly
-  add_custom_target(${V2X_GENERIC_TEST_NAME}_update_golden_${V2X_GENERIC_TEST_TYPE})
+  add_custom_target(${NAME}_update_golden_${TYPE})
+  add_custom_command(
+    TARGET ${NAME}_update_golden_${TYPE}
+    POST_BUILD
+    COMMAND cp ${ACTUAL_XML} ${CMAKE_CURRENT_SOURCE_DIR}/golden.${TYPE}.xml
+    )
 endfunction(V2X_GENERIC_TEST)

 function(V2X_TEST_MODEL)
@@ -63,7 +68,7 @@
   #
   # Usage: v2x_test_model(NAME <test_name> TOP_MODULE <top_module.v>) (All fields are required)

-  set(oneValueArgs NAME TOP_MODULE TYPE)
+  set(oneValueArgs NAME TOP_MODULE)
   cmake_parse_arguments(
     V2X_TEST_MODEL
     "${options}"
@@ -72,13 +77,16 @@
     ${ARGN}
   )

-  set(V2X_TEST_MODEL_SRC ${V2X_TEST_MODEL_NAME}.sim.v)
-  add_file_target(FILE ${V2X_TEST_MODEL_SRC} SCANNER_TYPE verilog)
-  v2x(NAME ${V2X_TEST_MODEL_NAME} SRCS ${V2X_TEST_MODEL_SRC} TOP_MODULE ${V2X_TEST_MODEL_TOP_MODULE})
+  set(NAME ${V2X_TEST_MODEL_NAME})
+  set(TOP_MODULE ${V2X_TEST_MODEL_TOP_MODULE})

-  v2x_generic_test(NAME ${V2X_TEST_MODEL_NAME} TOP_MODULE ${V2X_TEST_MODEL_TOP_MODULE} TYPE model)
+  set(SRC ${NAME}.sim.v)
+  add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
+  v2x(NAME ${NAME} SRCS ${SRC} TOP_MODULE ${TOP_MODULE})

-  add_custom_target(${V2X_TEST_MODEL_NAME}_diff ALL DEPENDS ${V2X_TEST_MODEL_NAME}_model_diff)
+  v2x_generic_test(NAME ${NAME} TOP_MODULE ${TOP_MODULE} TYPE model)
+
+  add_custom_target(${NAME}_diff ALL DEPENDS ${NAME}_model_diff)
 endfunction(V2X_TEST_MODEL)

 function(V2X_TEST_PB_TYPE)
@@ -96,7 +104,7 @@
   #
   # Usage: v2x_test_model(NAME <test_name> TOP_MODULE <top_module.v>) (All fields are required)

-  set(oneValueArgs NAME TOP_MODULE TYPE)
+  set(oneValueArgs NAME TOP_MODULE)
   cmake_parse_arguments(
     V2X_TEST_PB_TYPE
     "${options}"
@@ -105,13 +113,16 @@
     ${ARGN}
   )

-  set(V2X_TEST_PB_TYPE_SRC ${V2X_TEST_PB_TYPE_NAME}.sim.v)
-  add_file_target(FILE ${V2X_TEST_PB_TYPE_SRC} SCANNER_TYPE verilog)
-  v2x(NAME ${V2X_TEST_PB_TYPE_NAME} SRCS ${V2X_TEST_PB_TYPE_SRC} TOP_MODULE ${V2X_TEST_PB_TYPE_TOP_MODULE})
+  set(NAME ${V2X_TEST_MODEL_NAME})
+  set(TOP_MODULE ${V2X_TEST_MODEL_TOP_MODULE})

-  v2x_generic_test(NAME ${V2X_TEST_PB_TYPE_NAME} TOP_MODULE ${V2X_TEST_PB_TYPE_TOP_MODULE} TYPE pb_type)
+  set(SRC ${NAME}.sim.v)
+  add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
+  v2x(NAME ${NAME} SRCS ${SRC} TOP_MODULE ${TOP_MODULE})

-  add_custom_target(${V2X_TEST_PB_TYPE_NAME}_diff ALL DEPENDS ${V2X_TEST_PB_TYPE_NAME}_pb_type_diff)
+  v2x_generic_test(NAME ${NAME} TOP_MODULE ${TOP_MODULE} TYPE pb_type)
+
+  add_custom_target(${NAME}_diff ALL DEPENDS ${NAME}_pb_type_diff)
 endfunction(V2X_TEST_PB_TYPE)

 function(V2X_TEST_BOTH)
@@ -130,7 +141,7 @@
   #
   # Usage: v2x_test_model(NAME <test_name> TOP_MODULE <top_module.v>) (All fields are required)

-  set(oneValueArgs NAME TOP_MODULE TYPE)
+  set(oneValueArgs NAME TOP_MODULE)
   cmake_parse_arguments(
     V2X_TEST_BOTH
     "${options}"
@@ -139,12 +150,15 @@
     ${ARGN}
   )

-  set(V2X_TEST_BOTH_SRC ${V2X_TEST_BOTH_NAME}.sim.v)
-  add_file_target(FILE ${V2X_TEST_BOTH_SRC} SCANNER_TYPE verilog)
-  v2x(NAME ${V2X_TEST_BOTH_NAME} SRCS ${V2X_TEST_BOTH_SRC} TOP_MODULE ${V2X_TEST_BOTH_TOP_MODULE})
+  set(NAME ${V2X_TEST_BOTH_NAME})
+  set(TOP_MODULE ${V2X_TEST_BOTH_TOP_MODULE})

-  v2x_generic_test(NAME ${V2X_TEST_BOTH_NAME} TOP_MODULE ${V2X_TEST_BOTH_TOP_MODULE} TYPE pb_type)
-  v2x_generic_test(NAME ${V2X_TEST_BOTH_NAME} TOP_MODULE ${V2X_TEST_BOTH_TOP_MODULE} TYPE model)
+  set(SRC ${NAME}.sim.v)
+  add_file_target(FILE ${SRC} SCANNER_TYPE verilog)
+  v2x(NAME ${NAME} SRCS ${SRC} TOP_MODULE ${TOP_MODULE})

-  add_custom_target(${V2X_TEST_BOTH_NAME}_diff ALL DEPENDS ${V2X_TEST_BOTH_NAME}_pb_type_diff ${V2X_TEST_BOTH_NAME}_model_diff)
+  v2x_generic_test(NAME ${NAME} TOP_MODULE ${MODULE} TYPE pb_type)
+  v2x_generic_test(NAME ${NAME} TOP_MODULE ${TOP_MODULE} TYPE model)
+
+  add_custom_target(${NAME}_diff ALL DEPENDS ${NAME}_pb_type_diff ${NAME}_model_diff)
 endfunction(V2X_TEST_BOTH)