Use a global property for available sprokit fixes

--- conf/sprokit-macro-fixes.cmake
+++ conf/sprokit-macro-fixes.cmake
@@ -7,13 +7,28 @@
 #
 #   sprokit_use_fixes([name ...])
 #     Set up future targets to use fixes for Boost used in sprokit.
-#     Does not affect parent directories.
+#     Does not affect parent directories. If called without arguments, all
+#     known fixes are used.

-set(SPROKIT_FIXES "@sprokit_fixes@"
-  CACHE INTERNAL "Fixes available from sprokit")
+define_property(GLOBAL
+  PROPERTY   sprokit_fixes
+  BRIEF_DOCS "A list of all fixes sprokit provides for various headers."
+  FULL_DOCS  "Some things in sprokit require a patched header (usually for "
+             "Boost) and as such, requires extra include directories for each "
+             "fix. The fixes available depends on whether sprokit was built "
+             "using them or not.")
+set_property(GLOBAL
+  PROPERTY sprokit_fixes
+  "@sprokit_fixes@")

 function (sprokit_use_fixes)
-  foreach (fix IN LISTS ARGN)
+  if (ARGN)
+    set(fixes "${ARGN}")
+  else ()
+    get_property(fixes GLOBAL
+      PROPERTY sprokit_fixes)
+  endif ()
+  foreach (fix IN LISTS fixes)
     foreach (includedir IN LISTS SPROKIT_INCLUDE_DIR)
       include_directories(BEFORE SYSTEM "${includedir}/fixes/${fix}")
     endforeach ()


Build fix: Deduce LLVM version even when using LLVM from SVN trunk

--- src/cmake/externalpackages.cmake
+++ src/cmake/externalpackages.cmake
@@ -206,7 +206,10 @@
 if (LLVM_LIBRARY AND LLVM_INCLUDES AND LLVM_DIRECTORY AND LLVM_LIB_DIR)
   # ensure include directory is added (in case of non-standard locations
   include_directories (BEFORE "${LLVM_INCLUDES}")
+  # Extract any wayward dots or "svn" suffixes from the version to yield
+  # an integer version number we can use to make compilation decisions.
   string (REGEX REPLACE "\\." "" OSL_LLVM_VERSION ${LLVM_VERSION})
+  string (REGEX REPLACE "svn" "" OSL_LLVM_VERSION ${OSL_LLVM_VERSION})
   message (STATUS "LLVM OSL_LLVM_VERSION = ${OSL_LLVM_VERSION}")
   add_definitions ("-DOSL_LLVM_VERSION=${OSL_LLVM_VERSION}")
   if (LLVM_STATIC)


More flexible find of llvm-config with suffixed with '-64' (#1238)

Signed-off-by: Larry Gritz <f0a1ce6f80112d72f7276457fd261d671b827567@larrygritz.com>

--- src/cmake/modules/FindLLVM.cmake
+++ src/cmake/modules/FindLLVM.cmake
@@ -30,9 +30,11 @@
         "/usr/local/opt/llvm/bin/")
 find_program (LLVM_CONFIG
               NAMES llvm-config-${LLVM_VERSION} llvm-config
+                    llvm-config-64-${LLVM_VERSION} llvm-config-64
               HINTS ${LLVM_CONFIG_PATH_HINTS} NO_DEFAULT_PATH)
 find_program (LLVM_CONFIG
               NAMES llvm-config-${LLVM_VERSION} llvm-config
+                    llvm-config-64-${LLVM_VERSION} llvm-config-64
               HINTS ${LLVM_CONFIG_PATH_HINTS})
 if (NOT LLVM_FIND_QUIETLY)
     message (STATUS "Found llvm-config '${LLVM_CONFIG}'")


Added components to install macros

Added components to install macros

--- build/macros.cmake
+++ build/macros.cmake
@@ -95,29 +95,31 @@
 	if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
 		install(
 			TARGETS ${_targ}
-			RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
-			ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
+			RUNTIME DESTINATION "${INSTALL_BIN_DIR}" COMPONENT Runtime
+			ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" COMPONENT Development
 		)
 		install(
-			FILES $<TARGET_PDB_FILE:${_targ}> DESTINATION "${INSTALL_BIN_DIR}" OPTIONAL
+			FILES $<TARGET_PDB_FILE:${_targ}> DESTINATION "${INSTALL_BIN_DIR}" COMPONENT Development OPTIONAL
 		)
 	endif()
 endmacro()

 macro(install_headers _head _dest)
-	if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
+	if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
 		install(
 			FILES ${_head}
 			DESTINATION "${_dest}"
+			COMPONENT Development
 		)
 	endif()
 endmacro()

 macro(install_header_dir _dir _dest _exclude)
-	if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
+	if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
 		install(
 			DIRECTORY "${_dir}/" #Note trailing slash
 			DESTINATION "${_dest}"
+			COMPONENT Development
 			PATTERN "${_exclude}" EXCLUDE
 		)
 	endif()


erge branch 'v2.1'

erge branch 'v2.1'

--- common/cmake/ispc.cmake
+++ common/cmake/ispc.cmake
@@ -36,7 +36,10 @@
   SET(ISPC_TARGET_DIR ${CMAKE_CURRENT_BINARY_DIR})
   INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${ISPC_TARGET_DIR})

-  STRING(REGEX REPLACE ";" ";-I;" ISPC_INCLUDE_DIR_PARMS "${ISPC_INCLUDE_DIR}")
+  IF(ISPC_INCLUDE_DIR)
+    STRING(REGEX REPLACE ";" ";-I;" ISPC_INCLUDE_DIR_PARMS "${ISPC_INCLUDE_DIR}")
+    SET(ISPC_INCLUDE_DIR_PARMS "-I" ${ISPC_INCLUDE_DIR_PARMS})
+  ENDIF()

   IF (__XEON__)
     STRING(REGEX REPLACE "," ";" target_list "${targets}")
@@ -87,7 +90,7 @@
       OUTPUT ${results} ${outdirh}/${fname}_ispc.h
       COMMAND mkdir -p ${outdir} \; ispc
       -I ${CMAKE_CURRENT_SOURCE_DIR}
-      -I ${ISPC_INCLUDE_DIR_PARMS}
+      ${ISPC_INCLUDE_DIR_PARMS}
       --pic
       -O3
       --target=${ISPC_TARGETS}


Issue #74: added libavfilter to CMake FFmpeg discovery module

--- src/cmake/ffmpeg/FindFFmpeg.cmake
+++ src/cmake/ffmpeg/FindFFmpeg.cmake
@@ -11,6 +11,7 @@
 PKG_SEARCH_MODULE(LIBAVCODEC REQUIRED libavcodec)
 PKG_SEARCH_MODULE(LIBAVUTIL REQUIRED libavutil)
 PKG_SEARCH_MODULE(LIBSWSCALE REQUIRED libswscale)
+PKG_SEARCH_MODULE(LIBAVFILTER REQUIRED libavfilter)

 # all include dirs and libs in a single var each
 SET(FFmpeg_INCLUDE_DIRS
@@ -18,18 +19,21 @@
     ${LIBAVCODEC_INCLUDE_DIRS}
     ${LIBAVUTIL_INCLUDE_DIRS}
     ${LIBSWSCALE_INCLUDE_DIRS}
+    ${LIBAVFILTER_INCLUDE_DIRS}
 )
 SET(FFmpeg_LIBRARY_DIRS
     ${LIBAVFORMAT_LIBRARY_DIRS}
     ${LIBAVCODEC_LIBRARY_DIRS}
     ${LIBAVUTIL_LIBRARY_DIRS}
     ${LIBSWSCALE_LIBRARY_DIRS}
+    ${LIBAVFILTER_LIBRARY_DIRS}
 )
 SET(FFmpeg_LIBS
     ${LIBAVFORMAT_LIBRARIES}
     ${LIBAVCODEC_LIBRARIES}
     ${LIBAVUTIL_LIBRARIES}
     ${LIBSWSCALE_LIBRARIES}
+    ${LIBAVFILTER_LIBRARIES}
 )

 # handle the QUIETLY and REQUIRED arguments and set


Disabled the new clang 3.6 -Winconsistent-missing-override warning on emscripten

--- cmake-toolchains/emscripten.toolchain.cmake
+++ cmake-toolchains/emscripten.toolchain.cmake
@@ -168,7 +168,7 @@
 set(CMAKE_SYSTEM_INCLUDE_PATH "${EMSCRIPTEN_ROOT_PATH}/system/include")

 # c++ compiler flags
-set(CMAKE_CXX_FLAGS "${EMSCRIPTEN_CONFIG_OPTION} ${EMSCRIPTEN_CACHE_OPTION} ${EMSCRIPTEN_TRACING_OPTION} -std=c++11 -stdlib=libc++ ${FIPS_EMSC_EXCEPTION_FLAGS} -fstrict-aliasing -Wall -Wno-warn-absolute-paths -Wno-multichar -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue")
+set(CMAKE_CXX_FLAGS "${EMSCRIPTEN_CONFIG_OPTION} ${EMSCRIPTEN_CACHE_OPTION} ${EMSCRIPTEN_TRACING_OPTION} -std=c++11 -stdlib=libc++ ${FIPS_EMSC_EXCEPTION_FLAGS} -fstrict-aliasing -Wall -Wno-warn-absolute-paths -Wno-multichar -Wextra -Wno-unused-parameter -Wno-unknown-pragmas -Wno-ignored-qualifiers -Wno-long-long -Wno-overloaded-virtual -Wno-deprecated-writable-strings -Wno-unused-volatile-lvalue -Wno-inconsistent-missing-override")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
 set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g -D_DEBUG_ -D_DEBUG -DFIPS_DEBUG=1")
 set(CMAKE_CXX_FLAGS_PROFILING "-O3 --profiling")


Handle correctly missing ZLIB for all platforms. Still some pats of ROOT will not build correctly.

--- cmake/modules/SearchInstalledSoftware.cmake
+++ cmake/modules/SearchInstalledSoftware.cmake
@@ -27,9 +27,7 @@
    endif()
 endif()
 if(builtin_zlib)
-  if(WIN32)
-    set(ZLIB_LIBRARY "")
-  endif()
+  set(ZLIB_LIBRARY "" CACHE PATH "" FORCE)
 endif()

 #---Check for Freetype---------------------------------------------------------------


add some new filters to CMake

add some new filters to CMake

--- ogles_gpgpu/common/proc/sugar.cmake
+++ ogles_gpgpu/common/proc/sugar.cmake
@@ -29,6 +29,8 @@
     fifo.h
     filter3x3.cpp
     filter3x3.h
+    fir3.cpp
+    fir3.h
     flow.cpp
     flow.h
     gauss.h
@@ -52,10 +54,14 @@
     nms.h
     pyramid.cpp
     pyramid.h
+    remap.cpp
+    remap.h
     shitomasi.cpp
     shitomasi.h
     tensor.cpp
     tensor.h
+    three.cpp
+    three.h
     thresh.cpp
     thresh.h
     transform.cpp


Add a BLAS3-based triangular Sylvester equation solver (Reference-LAPACK PR 651)

--- cmake/lapack.cmake
+++ cmake/lapack.cmake
@@ -123,7 +123,8 @@
    ssyevd_2stage.f ssyev_2stage.f ssyevx_2stage.f ssyevr_2stage.f
    ssbev_2stage.f ssbevx_2stage.f ssbevd_2stage.f ssygv_2stage.f
    sgesvdq.f slaorhr_col_getrfnp.f
-   slaorhr_col_getrfnp2.f sorgtsqr.f sorgtsqr_row.f sorhr_col.f )
+   slaorhr_col_getrfnp2.f sorgtsqr.f sorgtsqr_row.f sorhr_col.f
+   slarmm.f slatrs3.f strsyl3.f)

 set(SXLASRC sgesvxx.f sgerfsx.f sla_gerfsx_extended.f sla_geamv.f
    sla_gercond.f sla_gerpvgrw.f ssysvxx.f ssyrfsx.f
@@ -221,7 +222,8 @@
    cheevd_2stage.f cheev_2stage.f cheevx_2stage.f cheevr_2stage.f
    chbev_2stage.f chbevx_2stage.f chbevd_2stage.f chegv_2stage.f
    cgesvdq.f claunhr_col_getrfnp.f claunhr_col_getrfnp2.f
-   cungtsqr.f cungtsqr_row.f cunhr_col.f )
+   cungtsqr.f cungtsqr_row.f cunhr_col.f
+   clatrs3.f ctrsyl3.f )

 set(CXLASRC cgesvxx.f cgerfsx.f cla_gerfsx_extended.f cla_geamv.f
    cla_gercond_c.f cla_gercond_x.f cla_gerpvgrw.f
@@ -313,7 +315,8 @@
    dsyevd_2stage.f dsyev_2stage.f dsyevx_2stage.f dsyevr_2stage.f
    dsbev_2stage.f dsbevx_2stage.f dsbevd_2stage.f dsygv_2stage.f
    dcombssq.f dgesvdq.f dlaorhr_col_getrfnp.f
-   dlaorhr_col_getrfnp2.f dorgtsqr.f dorgtsqr_row.f dorhr_col.f )
+   dlaorhr_col_getrfnp2.f dorgtsqr.f dorgtsqr_row.f dorhr_col.f
+   dlarmm.f dlatrs3.f dtrsyl3.f)

 set(DXLASRC dgesvxx.f dgerfsx.f dla_gerfsx_extended.f dla_geamv.f
    dla_gercond.f dla_gerpvgrw.f dsysvxx.f dsyrfsx.f
@@ -415,7 +418,8 @@
    zheevd_2stage.f zheev_2stage.f zheevx_2stage.f zheevr_2stage.f
    zhbev_2stage.f zhbevx_2stage.f zhbevd_2stage.f zhegv_2stage.f
    zgesvdq.f zlaunhr_col_getrfnp.f zlaunhr_col_getrfnp2.f
-   zungtsqr.f zungtsqr_row.f zunhr_col.f)
+   zungtsqr.f zungtsqr_row.f zunhr_col.f
+   zlarts3.f ztrsyl3.f)

 set(ZXLASRC zgesvxx.f zgerfsx.f zla_gerfsx_extended.f zla_geamv.f
    zla_gercond_c.f zla_gercond_x.f zla_gerpvgrw.f zsysvxx.f zsyrfsx.f


CMake: Fixed dependency on .proto sources to generate protobufs.

Prior to this, the CMake build only generated protobufs when the
"include" or "src" directories were not present.  In order to
re-generate protobufs, you needed to delete these directories.

Review: https://reviews.apache.org/r/49928/

--- src/cmake/MesosProtobuf.cmake
+++ src/cmake/MesosProtobuf.cmake
@@ -64,7 +64,7 @@
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CC} ${H}
     COMMAND ${PROTOC} ${TO_INCLUDE_DIR} ${PROTO}
-    DEPENDS make_bin_include_dir
+    DEPENDS make_bin_include_dir ${PROTO}
     WORKING_DIRECTORY ${MESOS_BIN})
 endfunction()

@@ -97,6 +97,6 @@
   ADD_CUSTOM_COMMAND(
     OUTPUT ${CC} ${H}
     COMMAND ${PROTOC} ${TO_SRC_DIR} ${PROTO}
-    DEPENDS make_bin_src_dir
+    DEPENDS make_bin_src_dir ${PROTO}
     WORKING_DIRECTORY ${MESOS_BIN})
 endfunction()


[CMake] Don't use hashes in target names

This code was added in the mega-commit 6670bb7 with the commit message "Rewrite the CMake build system", so I'm a little bit light on context here. The comment in the code was:

# Construct a unique name for the custom target.
# Use a hash so that the file name does not push the OS limits for filename
# length.

This seems bunk to me. Since the string being hashed is a filename it seems to me that we don't need a hash to stay under the OS filename size limits. Additionally since output files must be unique using the filename as the unique target name seems like a good idea to me. The only issue here is that custom target names can't contain '/'s. To workaround that we replace the '/' character with '-'.

This patch has the added benefit of having the full filename encoded into the target names, so if you need to debug the build dependency graph you can much more easily walk back from the generated build files to the place in CMake where it was generated.

--- cmake/modules/SwiftAddCustomCommandTarget.cmake
+++ cmake/modules/SwiftAddCustomCommandTarget.cmake
@@ -120,15 +120,9 @@
   set(ACCT_COMMANDS ${ACCT_UNPARSED_ARGUMENTS})

   if("${ACCT_CUSTOM_TARGET_NAME}" STREQUAL "")
-    # Construct a unique name for the custom target.
-    # Use a hash so that the file name does not push the OS limits for filename
-    # length.
+    # CMake doesn't allow '/' characters in filenames, so replace them with '-'
     list(GET ACCT_OUTPUT 0 output_filename)
-    string(MD5 target_md5
-        "add_custom_command_target${CMAKE_CURRENT_BINARY_DIR}/${output_filename}")
-    get_filename_component(output_filename_basename "${output_filename}" NAME)
-    set(target_name
-        "add_custom_command_target-${target_md5}-${output_filename_basename}")
+    string(REPLACE "/" "-" target_name "${output_filename}")
   else()
     set(target_name "${ACCT_CUSTOM_TARGET_NAME}")
   endif()


cmake: fix gnu.toolchain

cmake: fix gnu.toolchain

- CMAKE_FIND_ROOT_PATH_MODE_PROGRAM: ONLY => NEVER
- update handling of CMAKE_FIND_ROOT_PATH_MODE_* variables

--- platforms/linux/gnu.toolchain.cmake
+++ platforms/linux/gnu.toolchain.cmake
@@ -57,15 +57,51 @@
 endif() # IN_TRY_COMPILE

 set(CMAKE_SKIP_RPATH TRUE)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
+
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_LIBRARY)
+  set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+endif()
+
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_INCLUDE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+endif()
+
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PACKAGE)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+endif()
+
+if(NOT CMAKE_FIND_ROOT_PATH_MODE_PROGRAM)
+  set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+endif()
+
+macro(__cmake_find_root_save_and_reset)
+  foreach(v
+      CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
+      CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
+      CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
+      CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
+  )
+    set(__save_${v} ${${v}})
+    set(${v} NEVER)
+  endforeach()
+endmacro()
+
+macro(__cmake_find_root_restore)
+  foreach(v
+      CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
+      CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
+      CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
+      CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
+  )
+    set(${v} ${__save_${v}})
+    unset(__save_${v})
+  endforeach()
+endmacro()
+

 # macro to find programs on the host OS
 macro(find_host_program)
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+ __cmake_find_root_save_and_reset()
  if(CMAKE_HOST_WIN32)
   SET(WIN32 1)
   SET(UNIX)
@@ -77,16 +113,12 @@
  SET(WIN32)
  SET(APPLE)
  SET(UNIX 1)
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ __cmake_find_root_restore()
 endmacro()

 # macro to find packages on the host OS
 macro(find_host_package)
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
+ __cmake_find_root_save_and_reset()
  if(CMAKE_HOST_WIN32)
   SET(WIN32 1)
   SET(UNIX)
@@ -98,9 +130,7 @@
  SET(WIN32)
  SET(APPLE)
  SET(UNIX 1)
- set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
- set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
- set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+ __cmake_find_root_restore()
 endmacro()

 set(CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries.")


Adding more mpi wrappers (gnu, xlc, cray, ...)

--- MPI.cmake
+++ MPI.cmake
@@ -2,9 +2,44 @@
 # Copyright (c) 2012-2013 Fabien Delalondre <fabien.delalondre@epfl.ch>
 # Extension to support setting mpiwrappers as compilers
 # If not, relies on the findMPI.cmake script to set libs, includes and compile flags
+# Note: Improvement/evaluation must be made by comparing this script with:
+# 1) http://www.na-mic.org/svn/Slicer3-lib-mirrors/trunk/CMake/Modules/FindMPI.cmake
+# 2) http://www.openflipper.org/svnrepo/CoMISo/trunk/CoMISo/cmake/FindMPI.cmake

-string(REGEX MATCH "mpicc|mpixlc" MPICC_COMPILER "${CMAKE_C_COMPILER}")
-string(REGEX MATCH "mpicxx|mpixlcxx" MPICXX_COMPILER "${CMAKE_CXX_COMPILER}")
+# This module will set the following variables:
+#   MPI_WRAPPER_FOUND          TRUE if we have found MPI wrappers
+#   MPI_FOUND                  TRUE if we have found MPI
+#   MPI_COMPILE_FLAGS          Compilation flags for MPI programs
+#   MPI_INCLUDE_PATH           Include path(s) for MPI header
+#   MPI_LINK_FLAGS             Linking flags for MPI programs
+#   MPI_LIBRARY                First MPI library to link against (cached)
+#   MPI_EXTRA_LIBRARY          Extra MPI libraries to link against (cached)
+#   MPI_LIBRARIES              All libraries to link MPI programs against
+
+
+# Start with the list of MPI wrappers. Acknowledgement to http://www.openflipper.org/svnrepo/CoMISo/trunk/CoMISo/cmake/FindMPI.cmake
+# Generic MPI compilers
+set(_MPI_C_COMPILER_NAMES                  "mpicc|mpcc|mpicc_r|mpcc_r")
+set(_MPI_CXX_COMPILER_NAMES                "mpicxx|mpiCC|mpcxx|mpCC|mpic++|mpc++")
+# GNU compiler names
+set(_MPI_GNU_C_COMPILER_NAMES              "mpigcc|mpgcc|mpigcc_r|mpgcc_r")
+set(_MPI_GNU_CXX_COMPILER_NAMES            "mpig++|mpg++|mpig++_r|mpg++_r")
+# Intel MPI compiler names
+set(_MPI_Intel_C_COMPILER_NAMES            "mpiicc")
+set(_MPI_Intel_CXX_COMPILER_NAMES          "mpiicpc|mpiicxx|mpiic++|mpiiCC")
+# PGI compiler names
+set(_MPI_PGI_C_COMPILER_NAMES              "mpipgcc|mppgcc")
+set(_MPI_PGI_CXX_COMPILER_NAMES            "mpipgCC|mppgCC")
+# XLC MPI Compiler names
+set(_MPI_XL_C_COMPILER_NAMES               "mpxlc|mpxlc_r|mpixlc|mpixlc_r")
+set(_MPI_XL_CXX_COMPILER_NAMES             "mpixlcxx|mpixlC|mpixlc++|mpxlcxx|mpxlc++|mpixlc++|mpxlCC|
+                                           mpixlcxx_r|mpixlC_r|mpixlc++_r|mpxlcxx_r|mpxlc++_r|mpixlc++_r|mpxlCC_r")
+
+# Find CC and CXX MPI wrappers
+string(REGEX MATCH "${_MPI_C_COMPILER_NAMES}|${_MPI_GNU_C_COMPILER_NAMES}|${_MPI_Intel_C_COMPILER_NAMES}|
+                    ${_MPI_PGI_C_COMPILER_NAMES}|${_MPI_XL_C_COMPILER_NAMES}")
+string(REGEX MATCH "mpicc|mpixlc|mpixlc_r|mpicc_r|mpiicc|mpipgcc|mppgcc|" MPICC_COMPILER "${CMAKE_C_COMPILER}")
+#string(REGEX MATCH "mpicxx|mpixlcxx|mpixlcxx_r|mpicxx_r|" MPICXX_COMPILER "${CMAKE_CXX_COMPILER}")

 # Debugging
 #message(STATUS "Value of MPICC_COMPILER: " ${MPICC_COMPILER})
@@ -15,6 +50,7 @@
 if("${MPICC_COMPILER}" STREQUAL "" AND "${MPICXX_COMPILER}" STREQUAL "")
   message(STATUS "Could not find mpi wrappers in CMAKE_C_COMPILER or
 CMAKE_CXX_COMPILER. Trying to load mpi libs by default")
+  set(MPI_WRAPPER_FOUND FALSE CACHE BOOL "Did not find the MPI Wrappers")
   find_package(MPI REQUIRED)
   # Add mpi linking flags
   if(MPI_LINK_FLAGS)
@@ -29,6 +65,14 @@
   if(MPI_INCLUDE_PATH)
     INCLUDE_DIRECTORIES(${MPI_INCLUDE_PATH})
   endif()
+else()
+  # Setting wrappers and mpi found to true
+  set(MPI_WRAPPER_FOUND TRUE CACHE BOOL "found the MPI Wrappers")
+  set(MPI_FOUND TRUE CACHE BOOL "Found the MPI library")
 endif()

-
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND TRUE CACHE BOOL "Found the MPI library")
+else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND FALSE CACHE BOOL "Did not find the MPI library")
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)


Another fix for CI.

Another fix for CI.

--- cmake/Cairo.cmake
+++ cmake/Cairo.cmake
@@ -11,6 +11,7 @@
 if(WIN32)
     set(Cairo_Spec_BuildCommand BUILD_COMMAND
         sed -i "/.* sh .\\/make-/i\\\\ttest -e \\$\\@ \\&\\& rm \\$\\@" test/Makefile && make
+        NEVER_LOG_BUILD
     )

     set(Cairo_Spec_AutoconfFlags


Pull from the repository's origin/hooks branch

--- cmake/hooks.cmake
+++ cmake/hooks.cmake
@@ -23,7 +23,7 @@
   COMMAND "${GIT_EXECUTABLE}"
           fetch
           origin
-          hooks
+          remotes/origin/hooks
   COMMAND "${GIT_EXECUTABLE}"
           merge
           FETCH_HEAD


cmake: remove unused functions

cmake: remove unused functions

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -22,16 +22,6 @@
 function(message_colored message_level text color)
   string(ASCII 27 esc)
   message(${message_level} "${esc}[${color}m${text}${esc}[0m")
-endfunction()
-
-# }}}
-# require_binary : Locates binary by name and exports its path to BINPATH_${name} {{{
-
-function(require_binary binary_name)
-  find_program(BINPATH_${binary_name} ${binary_name})
-  if(NOT BINPATH_${binary_name})
-    message_colored(FATAL_ERROR "Failed to locate ${binary_name} binary" 31)
-  endif()
 endfunction()

 # }}}
@@ -89,90 +79,3 @@
 endfunction()

 # }}}
-# make_library : Builds a library target {{{
-
-function(make_library target_name)
-  set(zero_value_args SHARED STATIC)
-  set(one_value_args PACKAGE HEADER_INSTALL_DIR)
-  set(multi_value_args SOURCES HEADERS INCLUDE_DIRS PKG_DEPENDS CMAKE_DEPENDS TARGET_DEPENDS RAW_DEPENDS)
-
-  cmake_parse_arguments(LIB
-    "${zero_value_args}" "${one_value_args}"
-    "${multi_value_args}" ${ARGN})
-
-  # make the header paths absolute
-  foreach(HEADER ${LIB_HEADERS})
-    set(LIB_HEADERS_ABS ${LIB_HEADERS_ABS} ${PROJECT_SOURCE_DIR}/include/${HEADER})
-  endforeach()
-
-  # add defined INCLUDE_DIRS
-  foreach(DIR ${LIB_INCLUDE_DIRS})
-    string(TOUPPER ${DIR} DIR)
-    include_directories(${DIR})
-    include_directories(${${DIR}_INCLUDE_DIRS})
-  endforeach()
-
-  # add INCLUDE_DIRS for all external dependencies
-  foreach(DEP ${LIB_TARGET_DEPENDS} ${LIB_PKG_DEPENDS} ${LIB_CMAKE_DEPENDS})
-    string(TOUPPER ${DEP} DEP)
-    include_directories(${${DEP}_INCLUDE_DIRS} ${${DEP}_INCLUDEDIRS})
-  endforeach()
-
-  if(LIB_SHARED)
-    list(APPEND library_targets ${target_name}_shared)
-  endif()
-  if(LIB_STATIC)
-    list(APPEND library_targets ${target_name}_static)
-  endif()
-
-  foreach(library_target_name ${library_targets})
-    message(STATUS "${library_target_name}")
-    add_library(${library_target_name} ${LIB_HEADERS_ABS} ${LIB_SOURCES})
-
-    # link libraries from pkg-config imports
-    foreach(DEP ${LIB_PKG_DEPENDS})
-      string(TOUPPER ${DEP} DEP)
-      target_link_libraries(${library_target_name} ${${DEP}_LDFLAGS})
-    endforeach()
-
-    # link libraries from cmake imports
-    foreach(DEP ${LIB_CMAKE_DEPENDS})
-      string(TOUPPER ${DEP} DEP)
-      target_link_libraries(${library_target_name} ${${DEP}_LIB}
-                                                   ${${DEP}_LIBRARY}
-                                                   ${${DEP}_LIBRARIES})
-    endforeach()
-
-    # link libraries that are build as part of this project
-    foreach(DEP ${LIB_TARGET_DEPENDS})
-      string(TOUPPER ${DEP} DEP)
-      if(LIB_BUILD_SHARED)
-        target_link_libraries(${library_target_name} ${DEP}_shared)
-      endif()
-      if(LIB_BUILD_STATIC)
-        target_link_libraries(${library_target_name} ${DEP}_static)
-      endif()
-    endforeach()
-
-    if(${LIB_RAW_DEPENDS})
-      if(LIB_BUILD_STATIC)
-        target_link_libraries(${library_target_name} ${LIB_RAW_DEPENDS})
-      endif()
-    endif()
-
-    # set the output file basename
-    set_target_properties(${library_target_name} PROPERTIES OUTPUT_NAME ${target_name})
-
-    # install headers
-    install(FILES ${LIBRARY_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIB_HEADERS_ABS})
-
-    # install targets
-    install(TARGETS ${LIBRARY_TARGETS}
-            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-            ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-            COMPONENT library)
-  endforeach()
-endfunction()
-
-# }}}


cmake: Fix version management

cmake: Fix version management

--- cmake/utils.cmake
+++ cmake/utils.cmake
@@ -1,22 +1,10 @@
-function(get_version_from_file VERSION_MAJOR VERSION_MINOR VERSION_PATCH)
-  file(STRINGS "Version.txt" VERSION_STR)
-  foreach(STR ${VERSION_STR})
-    if(${STR} MATCHES "OR_TOOLS_MAJOR=(.*)")
-      set(${VERSION_MAJOR} ${CMAKE_MATCH_1} PARENT_SCOPE)
-    endif()
-    if(${STR} MATCHES "OR_TOOLS_MINOR=(.*)")
-      set(${VERSION_MINOR} ${CMAKE_MATCH_1} PARENT_SCOPE)
-    endif()
-  endforeach()
-  set(${VERSION_PATCH} 9999 PARENT_SCOPE)
-endfunction()
-
-function(get_version_from_git VERSION_MAJOR VERSION_MINOR VERSION_PATCH)
+function(get_patch_from_git VERSION_PATCH)
   find_package(Git QUIET)
   if(NOT GIT_FOUND)
-    message(STATUS "Did not find git package, get version from file...")
-    get_version_from_file(MAJOR MINOR PATCH)
+    message(STATUS "Did not find git package.")
+    set(PATCH 9999)
   else()
+    # If no tags can be found, it is a git shallow clone
     execute_process(COMMAND
       ${GIT_EXECUTABLE} describe --tags
       RESULT_VARIABLE _OUTPUT_VAR
@@ -33,24 +21,32 @@
       STRING(STRIP PATCH ${PATCH})
       STRING(REGEX REPLACE "\n$" "" PATCH ${PATCH})
       STRING(REGEX REPLACE " " "" PATCH ${PATCH})
-      STRING(REGEX REPLACE "^v([0-9]+)\\..*" "\\1" MAJOR "${FULL}")
-      STRING(REGEX REPLACE "^v[0-9]+\\.([0-9]+).*" "\\1" MINOR "${FULL}")
     else()
-      message(STATUS "Did not find any tag")
-      get_version_from_file(MAJOR MINOR PATCH)
+      message(STATUS "Did not find any tag.")
+      set(PATCH 9999)
     endif()
   endif()
-  set(${VERSION_MAJOR} ${MAJOR} PARENT_SCOPE)
-  set(${VERSION_MINOR} ${MINOR} PARENT_SCOPE)
   set(${VERSION_PATCH} ${PATCH} PARENT_SCOPE)
 endfunction()

 function(set_version VERSION)
+  # Get Major and Minor from Version.txt
+  file(STRINGS "Version.txt" VERSION_STR)
+  foreach(STR ${VERSION_STR})
+    if(${STR} MATCHES "OR_TOOLS_MAJOR=(.*)")
+      set(MAJOR ${CMAKE_MATCH_1})
+    endif()
+    if(${STR} MATCHES "OR_TOOLS_MINOR=(.*)")
+      set(MINOR ${CMAKE_MATCH_1})
+    endif()
+  endforeach()
+
+  # Compute Patch if .git is present otherwise set it to 9999
   get_filename_component(GIT_DIR ".git" ABSOLUTE)
   if(EXISTS ${GIT_DIR})
-    get_version_from_git(MAJOR MINOR PATCH)
+    get_patch_from_git(PATCH)
   else()
-    get_version_from_file(MAJOR MINOR PATCH)
+    set(PATCH 9999)
   endif()
   set(${VERSION} "${MAJOR}.${MINOR}.${PATCH}" PARENT_SCOPE)
 endfunction()


add generated constant definitions to library

Summary: when trying to build openr with `getDeps.py` constant definitions where not available since they were not part of the generated thrift lib. this fixes it.

Reviewed By: chadaustin

Differential Revision: D16064417

fbshipit-source-id: ee2b3e061caf67235f4a873405cf6cd6fb663ef4

--- build/fbcode_builder/CMake/FBThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/FBThriftCppLibrary.cmake
@@ -59,12 +59,12 @@
   # Compute the list of generated files
   list(APPEND generated_headers
     "${output_dir}/gen-cpp2/${base}_constants.h"
-    "${output_dir}/gen-cpp2/${base}_constants.cpp"
     "${output_dir}/gen-cpp2/${base}_types.h"
     "${output_dir}/gen-cpp2/${base}_types.tcc"
     "${output_dir}/gen-cpp2/${base}_types_custom_protocol.h"
   )
   list(APPEND generated_sources
+    "${output_dir}/gen-cpp2/${base}_constants.cpp"
     "${output_dir}/gen-cpp2/${base}_data.h"
     "${output_dir}/gen-cpp2/${base}_data.cpp"
     "${output_dir}/gen-cpp2/${base}_types.cpp"


add remove flag macro.

add remove flag macro.

--- WkCompilerSetup.cmake
+++ WkCompilerSetup.cmake
@@ -89,6 +89,28 @@
 	ENDIF ()
 endmacro(WkAddCDefinitions Build)

+# Usage : WkRmDefaultCFlags( "FLAG_TO_MODIFY -new -flags" )
+macro(WkRmFlags FLAG)
+	IF ( ${FLAG} )
+		#explode string as list
+		set(CURRENT_C_ARGS ${${FLAG}})
+		separate_arguments(CURRENT_C_ARGS)
+		# remove items from list
+		LIST(REMOVE_ITEM CURRENT_C_ARGS ${ARGN})
+
+		#rewrite all arguments as string
+		set(NEW_FLAGS "")
+		foreach(f ${CURRENT_C_ARGS})
+			message(${f})
+			set(NEW_FLAGS "${NEW_FLAGS}${f} " )
+		endforeach(f)
+		set(${FLAG} ${NEW_FLAGS} CACHE STRING "" FORCE)
+	ELSE ( ${FLAG} )
+		message(${FLAG} " not set!")
+	ENDIF ( ${FLAG} )
+
+endmacro(WkRmFlags)
+
 # Usage : WkSetCXXFlags( "-new -flags" )
 macro(WkSetCXXFlags)
 	SET(${PROJECT_NAME}_CXX_FLAGS "${ARGN}" CACHE STRING "${PROJECT_NAME} Flags for C++ Compiler.")


Bugfix: Read in CTestCustom.cmake if available

git-svn-id: 59f82343654cec32357d3b049d399063e4e4cfc7@31012 0785d39b-7218-0410-832d-ea1e28bc413d

--- tests/run_testsuite.cmake
+++ tests/run_testsuite.cmake
@@ -135,6 +135,12 @@
 MESSAGE("-- CTEST_SOURCE_DIRECTORY: ${CTEST_SOURCE_DIRECTORY}")

 #
+# Read in custom config files:
+#
+
+CTEST_READ_CUSTOM_FILES(${CTEST_SOURCE_DIRECTORY})
+
+#
 # CTEST_BINARY_DIRECTORY:
 #

@@ -154,6 +160,12 @@
       )
   ENDIF()
 ENDIF()
+
+#
+# Read in custom config files:
+#
+
+CTEST_READ_CUSTOM_FILES(${CTEST_BINARY_DIRECTORY})

 # Make sure that for a build test the directory is empty:
 FILE(GLOB _test ${CTEST_BINARY_DIRECTORY}/*)


Remove trailing whitespaces

Remove trailing whitespaces

--- cmake/modules/hunter_download_cache_meta_file.cmake
+++ cmake/modules/hunter_download_cache_meta_file.cmake
@@ -75,7 +75,7 @@
             url
             "${server}"
         )
-
+
         set(local_url "${url}/master/${local_suffix}")
         set(done_url "${url}/master/${done_suffix}")
       endif()


Synchronize adm files

Synchronize adm files

--- adm_local_without_kernel/cmake_files/SalomeSetupPlatform.cmake
+++ adm_local_without_kernel/cmake_files/SalomeSetupPlatform.cmake
@@ -95,7 +95,7 @@
   SET(PLATFORM_LIBS Ws2_32.lib)
   LIST(APPEND PLATFORM_LIBS Userenv.lib)      # At least for GEOM suit

-  IF(MACHINE_IS_64)
+  IF(MACHINE_IS_64)
     ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
     ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0) # To avoid runtime error during checking iterators
     SET(SIZE_OF_LONG "4")                        # set sizeof(long) to 4 byte
@@ -103,6 +103,9 @@
 ELSE()
   ## Linux specific:
   SET(PLATFORM_LIBS dl)    # Dynamic loading (dlopen, dlsym)
+  IF(MACHINE_IS_64)
+    ADD_DEFINITIONS(-DPCLINUX64)
+  ENDIF(MACHINE_IS_64)
 ENDIF()

 ## define _DEBUG_ macro


fixes to mac mono detection

fixes to mac mono detection

--- build/modules/FindMono.cmake
+++ build/modules/FindMono.cmake
@@ -88,7 +88,6 @@
   IF(MONO_EXECUTABLE AND MCS_EXECUTABLE AND GMCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
     SET(MONO_LOOK_FOR_LIBRARIES TRUE)
   ELSE(MONO_EXECUTABLE AND MCS_EXECUTABLE AND GMCS_EXECUTABLE AND GACUTIL_EXECUTABLE)
-
     SET(MONO_FOUND FALSE)
   ENDIF()

@@ -142,12 +141,12 @@
         SET(MONO_FOUND TRUE)
         SET(PKG_CONFIG_EXECUTABLE ${MONO_PKG_CONFIG})
         SET(PKG_CONFIG_FOUND TRUE)
-        #SET(MONO_INCLUDE_DIRS ${Mono_FRAMEWORKS}/Headers/mono-1.0
-        #                       ${Mono_FRAMEWORKS}/Headers/glib-2.0
-        #                       ${Mono_FRAMEWORKS}/Libraries/glib-2.0/include)
-        #SET(MONO_LIBRARY_DIRS ${Mono_FRAMEWORKS}/Libraries)
-        #SET(MONO_LIBRARIES mono  glib-2.0 intl iconv gthread-2.0)
-        #MESSAGE(STATUS "${MONO_INCLUDE_DIRS} XX ${MONO_LIBRARY_DIRS} YY ${MONO_LIBRARIES}")
+        SET(MONO_INCLUDE_DIRS ${Mono_FRAMEWORKS}/Headers/mono-1.0
+                               ${Mono_FRAMEWORKS}/Headers/glib-2.0
+                               ${Mono_FRAMEWORKS}/Libraries/glib-2.0/include)
+        SET(MONO_LIBRARY_DIRS ${Mono_FRAMEWORKS}/Libraries)
+        SET(MONO_LIBRARIES mono  glib-2.0 intl iconv gthread-2.0)
+        MESSAGE(STATUS "${MONO_INCLUDE_DIRS} XX ${MONO_LIBRARY_DIRS} YY ${MONO_LIBRARIES}")
       ENDIF(Mono_FRAMEWORKS)

     ELSE(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
@@ -160,12 +159,16 @@
       MESSAGE(STATUS "Could not find suitable pkg-config to search for Mono")
       SET(MONO_FOUND FALSE)
     ELSE(NOT PKG_CONFIG_FOUND)
-
-      IF(MONO_MINIMUM_VERSION)
-        PKG_CHECK_MODULES(MONO mono>=${MONO_MINIMUM_VERSION})  # will set MONO_FOUND
-      ELSE(MONO_MINIMUM_VERSION)
-        PKG_CHECK_MODULES(MONO mono)  # will set MONO_FOUND
-      ENDIF(MONO_MINIMUM_VERSION)
+      #IF(NOT APPLE)
+        IF(MONO_MINIMUM_VERSION)
+          PKG_CHECK_MODULES(MONO mono>=${MONO_MINIMUM_VERSION})  # will set MONO_FOUND
+        ELSE(MONO_MINIMUM_VERSION)
+           PKG_CHECK_MODULES(MONO mono)  # will set MONO_FOUND
+        ENDIF(MONO_MINIMUM_VERSION)
+      #ENDIF()
+      IF(APPLE AND EXISTS "/Library/Frameworks/Mono.framework")
+        SET(MONO_FOUND TRUE)
+      ENDIF()
     ENDIF(NOT PKG_CONFIG_FOUND)

@@ -215,6 +218,7 @@
     #adjust the path
     GET_FILENAME_COMPONENT(__MONO_PKG_CONFIG_PATH ${MONO_EXECUTABLE_PATH} PATH)
     SET(__MONO_PKG_CONFIG_PATH ${__MONO_PKG_CONFIG_PATH}/Libraries/pkgconfig/mono.pc)
+#    SET(MONO_INCLUDE_DIRS ${__MONO_PKG_CONFIG_PATH}/Headers)
   ELSE()
     SET(__MONO_PKG_CONFIG_PATH ${MONO_EXECUTABLE_PATH}/../lib/pkgconfig/mono.pc)
   ENDIF()


update setup_module_test_case.macro.cmake to enable parallel module test

--- utilities/cmake/setup_module_test_case.macro.cmake
+++ utilities/cmake/setup_module_test_case.macro.cmake
@@ -8,7 +8,16 @@
 UNSET(_current_dir_name)

 SET (__test_driver  ${_test_name}_exe)
-SET (_exec_run ${__test_driver})
+IF (_exec_run MATCHES "${_exec_mpi}")
+    SET (_exec_run ${_exec_mpi})
+    IF(NOT DEFINED _n_slots)
+      SET(_n_slots 2)
+    ENDIF()
+    SET (_para_run -n ${_n_slots} ${__test_driver} ${_input_file_list} > screen.log 2>&1)
+    LIST (APPEND _additional_clean_up_files "screen.log")
+ELSE()
+  SET (_exec_run ${__test_driver})
+ENDIF()
 set (_extra_depends_for_output ${__test_driver})
 add_executable(${__test_driver}
                EXCLUDE_FROM_ALL


Remove pointless CMake version requirement

--- cmake/Plugin.cmake
+++ cmake/Plugin.cmake
@@ -1,5 +1,3 @@
-cmake_minimum_required(VERSION 2.8.6)
-
 function(add_plugin name)
   add_library(${name} MODULE ${ARGN})


cmake(dotnet): Rework dotnet.cmake

cmake(dotnet): Rework dotnet.cmake


Remove redurant the extra semicolon in virgil.cmake

--- cmake/virgil.cmake
+++ cmake/virgil.cmake
@@ -105,7 +105,7 @@
         set (ED25519_LIB_DIR "${INSTALL_DIR}/lib/${ED25519_LIBRARY_NAME}")

         set (VIRGIL_LIBRARIES
-                "${VIRGIL_CRYPTO_LIB_DIR};${MBEDTLS_LIB_DIR};${ED25519_LIB_DIR};")
+                "${VIRGIL_CRYPTO_LIB_DIR};${MBEDTLS_LIB_DIR};${ED25519_LIB_DIR}")

     elseif (${module} STREQUAL "virgil-sdk")
         set (VIRGIL virgil_sdk)


Set newest OSX deployment target

Set newest OSX deployment target

--- BuildSupport.cmake
+++ BuildSupport.cmake
@@ -53,7 +53,7 @@
     # Important to use FALLBACK variable.
     # https://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryUsageGuidelines.html
     set (BUILDEM_LD_LIBRARY_VAR "DYLD_FALLBACK_LIBRARY_PATH")
-    set (BUILDEM_PLATFORM_SPECIFIC_ENV "MACOSX_DEPLOYMENT_TARGET=10.5")
+    set (BUILDEM_PLATFORM_SPECIFIC_ENV "MACOSX_DEPLOYMENT_TARGET=10.9")
     set (BUILDEM_PLATFORM_DYLIB_EXTENSION "dylib")
 else()
     set (BUILDEM_LD_LIBRARY_VAR "LD_LIBRARY_PATH")


Backup. Merging cmake fixes into master.

--- sheaves/component_definitions.cmake
+++ sheaves/component_definitions.cmake
@@ -138,7 +138,7 @@
         set_target_properties(${${COMPONENT}_STATIC_LIB}
             PROPERTIES OUTPUT_NAME
             ${PROJECT_NAME} LINKER_LANGUAGE CXX)
-        target_link_libraries(${${COMPONENT}_STATIC_LIB} hdf5_cpp )
+        target_link_libraries(${${COMPONENT}_STATIC_LIB} LINK_PRIVATE hdf5 )

         # Shared library
         add_library(${${COMPONENT}_SHARED_LIB}
@@ -150,7 +150,7 @@
             PROPERTIES
             LINK_INTERFACE_LIBRARIES "")
         target_link_libraries(${${COMPONENT}_SHARED_LIB}
-            -Wl,-Bstatic hdf5_cpp -Wl,-Bdynamic)
+            LINK_PRIVATE -Wl,-Bstatic hdf5 -Wl,-Bdynamic)

         # Override cmake's placing of "${COMPONENT_LIB}_EXPORTS into the preproc
         # symbol table. CMake apparently detects the presence of cdecl_dllspec in


COMP: add HDF5 libraries to ITK_LIBRARIES in ITKConfig.cmake

Change-Id: I76621c7d1679500f8d7b0633d1223732f9ef8e2e

--- CMake/UseITK.cmake
+++ CMake/UseITK.cmake
@@ -30,7 +30,7 @@
     endif()
   endforeach()

-  foreach (ImageFormat  Nifti Nrrd Gipl)
+  foreach (ImageFormat  Nifti Nrrd Gipl HDF5 )
     string(TOUPPER ${ImageFormat} ImageFormat_UPPER)
     if (ITK-IO-${ImageFormat_UPPER}_LOADED)
       set (LIST_OF_FACTORIES_REGISTRATION "${LIST_OF_FACTORIES_REGISTRATION}void ${ImageFormat}ImageIOFactoryRegister__Private(void);")


* #267

* #267

--- cmake/Modules/AddIOWOW.cmake
+++ cmake/Modules/AddIOWOW.cmake
@@ -14,6 +14,12 @@
   else()
     set(IOWOW_URL https://github.com/Softmotions/iowow/archive/master.zip)
   endif()
+endif()
+
+if (IOS)
+  set(BYPRODUCT "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow-1.a")
+else()
+  set(BYPRODUCT "${CMAKE_BINARY_DIR}/lib/libiowow-1.a")
 endif()

 set(CMAKE_ARGS  -DOWNER_PROJECT_NAME=${PROJECT_NAME}
@@ -52,14 +58,14 @@
   LOG_CONFIGURE OFF
   LOG_INSTALL OFF
   CMAKE_ARGS ${CMAKE_ARGS}
-  BUILD_BYPRODUCTS "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow-1.a"
+  BUILD_BYPRODUCTS ${BYPRODUCT}
 )

 add_library(iowow_s STATIC IMPORTED GLOBAL)
 set_target_properties(
    iowow_s
    PROPERTIES
-   IMPORTED_LOCATION "${CMAKE_BINARY_DIR}/src/extern_iowow-build/src/libiowow-1.a"
+   IMPORTED_LOCATION ${BYPRODUCT}
 )
 add_dependencies(iowow_s extern_iowow)


Squashed '3rdparty/github/cmake-utils/' changes from 6aca3dc6..c219386d

c219386d Specify component for every library type

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

--- cmake/MyPackageLibrary.cmake
+++ cmake/MyPackageLibrary.cmake
@@ -84,8 +84,16 @@
       TARGET_INCLUDE_DIRECTORIES(${_target} ${_include_directory_scope} ${_include_directory})
     ENDFOREACH ()
   ENDFOREACH ()
-  INSTALL (TARGETS ${PROJECT_NAME}        RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT DynamicLibraryComponent)
-  INSTALL (TARGETS ${PROJECT_NAME}_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT StaticLibraryComponent)
+  INSTALL (TARGETS ${PROJECT_NAME}
+    RUNTIME DESTINATION bin COMPONENT DynamicLibraryComponent
+    LIBRARY DESTINATION lib COMPONENT DynamicLibraryComponent
+    ARCHIVE DESTINATION lib COMPONENT DynamicLibraryComponent
+    )
+  INSTALL (TARGETS ${PROJECT_NAME}_static
+    RUNTIME DESTINATION bin COMPONENT StaticLibraryComponent
+    LIBRARY DESTINATION lib COMPONENT StaticLibraryComponent
+    ARCHIVE DESTINATION lib COMPONENT StaticLibraryComponent
+    )
   SET (_HAVE_DYNAMICLIBRARYCOMPONENT TRUE CACHE INTERNAL "Have DynamicLibraryComponent" FORCE)
   SET (_HAVE_STATICLIBRARYCOMPONENT TRUE CACHE INTERNAL "Have StaticLibraryComponent" FORCE)
   #


Update arch list

Update arch list

--- cmake/ThrustCudaConfig.cmake
+++ cmake/ThrustCudaConfig.cmake
@@ -1,6 +1,6 @@
 enable_language(CUDA)

-set(THRUST_KNOWN_COMPUTE_ARCHS 35 37 50 52 53 60 61 62 70 72 75 80)
+set(THRUST_KNOWN_COMPUTE_ARCHS 35 37 50 52 53 60 61 62 70 72 75 80 86)

 # Split CUDA_FLAGS into 3 parts:
 #


Little fix for external ColPack.cmake issue #1529

--- cmake/external/ColPack.cmake
+++ cmake/external/ColPack.cmake
@@ -5,7 +5,7 @@
 	DOWNLOAD_DIR ${THIRD_PARTY_DIR}/COLPACK
 	URL http://cscapes.cs.purdue.edu/download/ColPack/ColPack-1.0.9.tar.gz
 	URL_MD5 54ae2daacd00a0a278d2e4fa94bba81b
-	CONFIGURE_COMMAND rm <SOURCE_DIR>/config.status && <SOURCE_DIR>/configure --includedir=${THIRD_PARTY_DIR}/include/ColPack --libdir=${THIRD_PARTY_DIR}/libs/ColPack --disable-shared --with-pic
+	CONFIGURE_COMMAND <SOURCE_DIR>/configure --includedir=${THIRD_PARTY_DIR}/include/ColPack --libdir=${THIRD_PARTY_DIR}/libs/ColPack --disable-shared --with-pic
 	)

 SET(COLPACK_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include/ColPack)


build: expand SWIFT_MODULE_DEPENDS_<TARGET>

Expand the macros to have Linux and FreeBSD specific module depends.  This
enables us to build more libraries unconditionally.

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -1012,6 +1012,12 @@
 # SWIFT_MODULE_DEPENDS_WATCHOS
 #   Swift modules this library depends on when built for watchOS.
 #
+# SWIFT_MODULE_DEPENDS_FREEBSD
+#   Swift modules this library depends on when built for FreeBSD.
+#
+# SWIFT_MODULE_DEPENDS_LINUX
+#   Swift modules this library depends on when built for Linux.
+#
 # FRAMEWORK_DEPENDS
 #   System frameworks this library depends on.
 #
@@ -1076,7 +1082,7 @@
   cmake_parse_arguments(SWIFTLIB
     "${SWIFTLIB_options}"
     "INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_IOS"
-    "DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES"
+    "DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;SWIFT_MODULE_DEPENDS_FREEBSD;SWIFT_MODULE_DEPENDS_LINUX;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES"
     ${ARGN})
   set(SWIFTLIB_SOURCES ${SWIFTLIB_UNPARSED_ARGUMENTS})

@@ -1195,6 +1201,12 @@
         elseif("${sdk}" STREQUAL "WATCHOS" OR "${sdk}" STREQUAL "WATCHOS_SIMULATOR")
           list(APPEND swiftlib_module_depends_flattened
               ${SWIFTLIB_SWIFT_MODULE_DEPENDS_WATCHOS})
+        elseif("${sdk}" STREQUAL "FREEBSD")
+          list(APPEND swiftlib_module_depends_flattened
+               ${SWIFTLIB_SWIFT_MODULE_DEPENDS_FREEBSD})
+        elseif("${sdk}" STREQUAL "LINUX")
+          list(APPEND swiftlib_module_depends_flattened
+              ${SWIFTLIB_SWIFT_MODULE_DEPENDS_LINUX})
         endif()

         set(swiftlib_module_dependency_targets)


Split link flags and link libraries lists to make gold happy.

gold is more strict than lld about the order of the arguments, that's
why CMake offers two different properties for the linker: LINK_FLAGS and
LINK_LIBRARIES. The former _add_variant_link_flags was adding the
libraries to LINK_FLAGS, when the correct thing is to add them to
LINK_LIBRARIES.

The change adds a new output variable for _add_variant_link_flags which
will containt the linked libraries, and CMake will be able to generate
the correct command line invocation for when gold is used.

This should fix the Android CI build.

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -378,7 +378,7 @@
 function(_add_variant_link_flags)
   set(oneValueArgs SDK ARCH BUILD_TYPE ENABLE_ASSERTIONS ANALYZE_CODE_COVERAGE
   DEPLOYMENT_VERSION_OSX DEPLOYMENT_VERSION_IOS DEPLOYMENT_VERSION_TVOS DEPLOYMENT_VERSION_WATCHOS
-  RESULT_VAR_NAME ENABLE_LTO LTO_OBJECT_NAME LIBRARY_SEARCH_DIRECTORIES_VAR_NAME)
+  RESULT_VAR_NAME ENABLE_LTO LTO_OBJECT_NAME LINK_LIBRARIES_VAR_NAME LIBRARY_SEARCH_DIRECTORIES_VAR_NAME)
   cmake_parse_arguments(LFLAGS
     ""
     "${oneValueArgs}"
@@ -389,6 +389,7 @@
   precondition(LFLAGS_ARCH MESSAGE "Should specify an architecture")

   set(result ${${LFLAGS_RESULT_VAR_NAME}})
+  set(link_libraries ${${LFLAGS_LINK_LIBRARIES_VAR_NAME}})
   set(library_search_directories ${${LFLAGS_LIBRARY_SEARCH_DIRECTORIES_VAR_NAME}})

   _add_variant_c_compile_link_flags(
@@ -405,9 +406,9 @@
     RESULT_VAR_NAME result)

   if("${LFLAGS_SDK}" STREQUAL "LINUX")
-    list(APPEND result "-lpthread" "-latomic" "-ldl")
+    list(APPEND link_libraries "pthread" "atomic" "dl")
   elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD")
-    list(APPEND result "-lpthread")
+    list(APPEND link_libraries "pthread")
   elseif("${LFLAGS_SDK}" STREQUAL "CYGWIN")
     # No extra libraries required.
   elseif("${LFLAGS_SDK}" STREQUAL "WINDOWS")
@@ -425,9 +426,10 @@
     list(APPEND library_search_directories
          ${CMAKE_BINARY_DIR}/winsdk_lib_${LFLAGS_ARCH}_symlinks)
   elseif("${LFLAGS_SDK}" STREQUAL "HAIKU")
-    list(APPEND result "-lbsd" "-latomic" "-Wl,-Bsymbolic")
+    list(APPEND link_libraries "bsd" "atomic")
+    list(APPEND result "-Wl,-Bsymbolic")
   elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
-    list(APPEND result "-ldl" "-llog" "-latomic" "-licudataswift" "-licui18nswift" "-licuucswift")
+    list(APPEND link_libraries "dl" "log" "atomic" "icudataswift" "icui18nswift" "icuucswift")
     if("${LFLAGS_ARCH}" MATCHES armv7)
       list(APPEND result "${SWIFT_ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so")
     elseif("${LFLAGS_ARCH}" MATCHES aarch64)
@@ -437,7 +439,7 @@
     endif()
     swift_android_lib_for_arch(${LFLAGS_ARCH} ${LFLAGS_ARCH}_LIB)
     foreach(path IN LISTS ${LFLAGS_ARCH}_LIB)
-      list(APPEND library_search_directories ${path})
+      list(APPEND library_search_directories ${path})
     endforeach()
   else()
     # If lto is enabled, we need to add the object path flag so that the LTO code
@@ -477,6 +479,7 @@
   endif()

   set("${LFLAGS_RESULT_VAR_NAME}" "${result}" PARENT_SCOPE)
+  set("${LFLAGS_LINK_LIBRARIES_VAR_NAME}" "${link_libraries}" PARENT_SCOPE)
   set("${LFLAGS_LIBRARY_SEARCH_DIRECTORIES_VAR_NAME}" "${library_search_directories}" PARENT_SCOPE)
 endfunction()

@@ -1209,6 +1212,7 @@
     DEPLOYMENT_VERSION_TVOS "${SWIFTLIB_DEPLOYMENT_VERSION_TVOS}"
     DEPLOYMENT_VERSION_WATCHOS "${SWIFTLIB_DEPLOYMENT_VERSION_WATCHOS}"
     RESULT_VAR_NAME link_flags
+    LINK_LIBRARIES_VAR_NAME link_libraries
     LIBRARY_SEARCH_DIRECTORIES_VAR_NAME library_search_directories
       )

@@ -1253,6 +1257,7 @@
       COMPILE_FLAGS " ${c_compile_flags}")
   set_property(TARGET "${target}" APPEND_STRING PROPERTY
       LINK_FLAGS " ${link_flags}")
+  set_property(TARGET "${target}" APPEND PROPERTY LINK_LIBRARIES ${link_libraries})
   swift_target_link_search_directories("${target}" "${library_search_directories}")

   # Adjust the linked libraries for windows targets.  On Windows, the link is
@@ -2127,6 +2132,7 @@
     LTO_OBJECT_NAME "${name}-${SWIFTEXE_SINGLE_SDK}-${SWIFTEXE_SINGLE_ARCHITECTURE}"
     ANALYZE_CODE_COVERAGE "${SWIFT_ANALYZE_CODE_COVERAGE}"
     RESULT_VAR_NAME link_flags
+    LINK_LIBRARIES_VAR_NAME link_libraries
     LIBRARY_SEARCH_DIRECTORIES_VAR_NAME library_search_directories)

   if(${SWIFTEXE_SINGLE_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
@@ -2192,6 +2198,7 @@
   swift_target_link_search_directories("${name}" "${library_search_directories}")
   set_property(TARGET ${name} APPEND_STRING PROPERTY
       LINK_FLAGS " ${link_flags}")
+  set_property(TARGET ${name} APPEND PROPERTY LINK_LIBRARIES ${link_libraries})
   if (SWIFT_PARALLEL_LINK_JOBS)
     set_property(TARGET ${name} PROPERTY JOB_POOL_LINK swift_link_job_pool)
   endif()


Fix mismatch use of target_link_options

Fix mismatch use of target_link_options

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -1467,7 +1467,7 @@
   endif()

   if(target_static)
-    target_link_options(${target_static} PRIVATE
+    target_compile_options(${target_static} PRIVATE
       ${c_compile_flags})
     # FIXME: The fallback paths here are going to be dynamic libraries.


Exclude MLAS AVX512 in minimal build (#4905)

--- cmake/onnxruntime_mlas.cmake
+++ cmake/onnxruntime_mlas.cmake
@@ -56,6 +56,11 @@
       ${ONNXRUNTIME_ROOT}/core/mlas/lib/intrinsics/avx2/qladd_avx2.cpp
     )
     set_source_files_properties(${mlas_platform_srcs_avx2} PROPERTIES COMPILE_FLAGS "/arch:AVX2")
+
+    if (onnxruntime_MINIMAL_BUILD)
+      # exclude AVX512 in minimal build
+      set_source_files_properties(${mlas_common_srcs} PROPERTIES COMPILE_FLAGS "-DMLAS_AVX512F_UNSUPPORTED")
+    endif()

     set(mlas_platform_srcs
       ${mlas_platform_srcs_avx}
@@ -243,7 +248,7 @@
       COMPILES_AVX512F
     )

-    if(COMPILES_AVX512F)
+    if(COMPILES_AVX512F AND NOT onnxruntime_MINIMAL_BUILD)
       set(mlas_platform_srcs_avx512f
         ${ONNXRUNTIME_ROOT}/core/mlas/lib/x86_64/DgemmKernelAvx512F.S
         ${ONNXRUNTIME_ROOT}/core/mlas/lib/x86_64/SgemmKernelAvx512F.S


Cmake: fix OpenMP for older cmake versions (<3.9)

--- cmake/src-dependencies.cmake
+++ cmake/src-dependencies.cmake
@@ -52,9 +52,7 @@
       add_library(OpenMP::OpenMP_CXX INTERFACE IMPORTED)
       if(OpenMP_CXX_FLAGS)
         set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_COMPILE_OPTIONS ${OpenMP_CXX_FLAGS})
-      endif()
-      if(OpenMP_CXX_LIBRARIES)
-        set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_LIBRARIES})
+        set_property(TARGET OpenMP::OpenMP_CXX PROPERTY INTERFACE_LINK_LIBRARIES ${OpenMP_CXX_FLAGS})
       endif()
     endif()


Removed unnecessary script used for finding SFML library.

SFML is not used in Ylikuutio any more.

--- cmake_modules/FindSFML.cmake
+++ cmake_modules/FindSFML.cmake
@@ -1,364 +0,0 @@
-# This script locates the SFML library
-# ------------------------------------
-#
-# Usage
-# -----
-#
-# When you try to locate the SFML libraries, you must specify which modules you want to use (system, window, graphics, network, audio, main).
-# If none is given, the SFML_LIBRARIES variable will be empty and you'll end up linking to nothing.
-# example:
-#   find_package(SFML COMPONENTS graphics window system) # find the graphics, window and system modules
-#
-# You can enforce a specific version, either MAJOR.MINOR or only MAJOR.
-# If nothing is specified, the version won't be checked (i.e. any version will be accepted).
-# example:
-#   find_package(SFML COMPONENTS ...)     # no specific version required
-#   find_package(SFML 2 COMPONENTS ...)   # any 2.x version
-#   find_package(SFML 2.4 COMPONENTS ...) # version 2.4 or greater
-#
-# By default, the dynamic libraries of SFML will be found. To find the static ones instead,
-# you must set the SFML_STATIC_LIBRARIES variable to TRUE before calling find_package(SFML ...).
-# Since you have to link yourself all the SFML dependencies when you link it statically, the following
-# additional variables are defined: SFML_XXX_DEPENDENCIES and SFML_DEPENDENCIES (see their detailed
-# description below).
-# In case of static linking, the SFML_STATIC macro will also be defined by this script.
-# example:
-#   set(SFML_STATIC_LIBRARIES TRUE)
-#   find_package(SFML 2 COMPONENTS network system)
-#
-# On Mac OS X if SFML_STATIC_LIBRARIES is not set to TRUE then by default CMake will search for frameworks unless
-# CMAKE_FIND_FRAMEWORK is set to "NEVER" for example. Please refer to CMake documentation for more details.
-# Moreover, keep in mind that SFML frameworks are only available as release libraries unlike dylibs which
-# are available for both release and debug modes.
-#
-# If SFML is not installed in a standard path, you can use the SFML_ROOT CMake (or environment) variable
-# to tell CMake where SFML is.
-#
-# Output
-# ------
-#
-# This script defines the following variables:
-# - For each specified module XXX (system, window, graphics, network, audio, main):
-#   - SFML_XXX_LIBRARY_DEBUG:   the name of the debug library of the xxx module (set to SFML_XXX_LIBRARY_RELEASE is no debug version is found)
-#   - SFML_XXX_LIBRARY_RELEASE: the name of the release library of the xxx module (set to SFML_XXX_LIBRARY_DEBUG is no release version is found)
-#   - SFML_XXX_LIBRARY:         the name of the library to link to for the xxx module (includes both debug and optimized names if necessary)
-#   - SFML_XXX_FOUND:           true if either the debug or release library of the xxx module is found
-#   - SFML_XXX_DEPENDENCIES:    the list of libraries the module depends on, in case of static linking
-# - SFML_LIBRARIES:    the list of all libraries corresponding to the required modules
-# - SFML_FOUND:        true if all the required modules are found
-# - SFML_INCLUDE_DIR:  the path where SFML headers are located (the directory containing the SFML/Config.hpp file)
-# - SFML_DEPENDENCIES: the list of libraries SFML depends on, in case of static linking
-#
-# example:
-#   find_package(SFML 2 COMPONENTS system window graphics audio REQUIRED)
-#   include_directories(${SFML_INCLUDE_DIR})
-#   add_executable(myapp ...)
-#   target_link_libraries(myapp ${SFML_LIBRARIES})
-
-# define the SFML_STATIC macro if static build was chosen
-if(SFML_STATIC_LIBRARIES)
-    add_definitions(-DSFML_STATIC)
-endif()
-
-# define the list of search paths for headers and libraries
-set(FIND_SFML_PATHS
-    ${SFML_ROOT}
-    $ENV{SFML_ROOT}
-    ~/Library/Frameworks
-    /Library/Frameworks
-    /usr/local
-    /usr
-    /sw
-    /opt/local
-    /opt/csw
-    /opt)
-
-# find the SFML include directory
-find_path(SFML_INCLUDE_DIR SFML/Config.hpp
-          PATH_SUFFIXES include
-          PATHS ${FIND_SFML_PATHS})
-
-# check the version number
-set(SFML_VERSION_OK TRUE)
-if(SFML_FIND_VERSION AND SFML_INCLUDE_DIR)
-    # extract the major and minor version numbers from SFML/Config.hpp
-    # we have to handle framework a little bit differently:
-    if("${SFML_INCLUDE_DIR}" MATCHES "SFML.framework")
-        set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/Headers/Config.hpp")
-    else()
-        set(SFML_CONFIG_HPP_INPUT "${SFML_INCLUDE_DIR}/SFML/Config.hpp")
-    endif()
-    FILE(READ "${SFML_CONFIG_HPP_INPUT}" SFML_CONFIG_HPP_CONTENTS)
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_MAJOR ([0-9]+).*" "\\1" SFML_VERSION_MAJOR "${SFML_CONFIG_HPP_CONTENTS}")
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_MINOR ([0-9]+).*" "\\1" SFML_VERSION_MINOR "${SFML_CONFIG_HPP_CONTENTS}")
-    STRING(REGEX REPLACE ".*#define SFML_VERSION_PATCH ([0-9]+).*" "\\1" SFML_VERSION_PATCH "${SFML_CONFIG_HPP_CONTENTS}")
-    if (NOT "${SFML_VERSION_PATCH}" MATCHES "^[0-9]+$")
-        set(SFML_VERSION_PATCH 0)
-    endif()
-    math(EXPR SFML_REQUESTED_VERSION "${SFML_FIND_VERSION_MAJOR} * 10000 + ${SFML_FIND_VERSION_MINOR} * 100 + ${SFML_FIND_VERSION_PATCH}")
-
-    # if we could extract them, compare with the requested version number
-    if (SFML_VERSION_MAJOR)
-        # transform version numbers to an integer
-        math(EXPR SFML_VERSION "${SFML_VERSION_MAJOR} * 10000 + ${SFML_VERSION_MINOR} * 100 + ${SFML_VERSION_PATCH}")
-
-        # compare them
-        if(SFML_VERSION LESS SFML_REQUESTED_VERSION)
-            set(SFML_VERSION_OK FALSE)
-        endif()
-    else()
-        # SFML version is < 2.0
-        if (SFML_REQUESTED_VERSION GREATER 10900)
-            set(SFML_VERSION_OK FALSE)
-            set(SFML_VERSION_MAJOR 1)
-            set(SFML_VERSION_MINOR x)
-            set(SFML_VERSION_PATCH x)
-        endif()
-    endif()
-endif()
-
-# find the requested modules
-set(SFML_FOUND TRUE) # will be set to false if one of the required modules is not found
-foreach(FIND_SFML_COMPONENT ${SFML_FIND_COMPONENTS})
-    string(TOLOWER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_LOWER)
-    string(TOUPPER ${FIND_SFML_COMPONENT} FIND_SFML_COMPONENT_UPPER)
-    set(FIND_SFML_COMPONENT_NAME sfml-${FIND_SFML_COMPONENT_LOWER})
-
-    # no suffix for sfml-main, it is always a static library
-    if(FIND_SFML_COMPONENT_LOWER STREQUAL "main")
-        # release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-    else()
-        # static release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-s
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # static debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-s-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # dynamic release library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
-                     NAMES ${FIND_SFML_COMPONENT_NAME}
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # dynamic debug library
-        find_library(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG
-                     NAMES ${FIND_SFML_COMPONENT_NAME}-d
-                     PATH_SUFFIXES lib64 lib
-                     PATHS ${FIND_SFML_PATHS})
-
-        # choose the entries that fit the requested link type
-        if(SFML_STATIC_LIBRARIES)
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE})
-            endif()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG})
-            endif()
-        else()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE})
-            endif()
-            if(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
-                set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG})
-            endif()
-        endif()
-    endif()
-
-    if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG OR SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-        # library found
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND TRUE)
-
-        # if both are found, set SFML_XXX_LIBRARY to contain both
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY debug     ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG}
-                                                          optimized ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-        endif()
-
-        # if only one debug/release variant is found, set the other to be equal to the found one
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE)
-            # debug and not release
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY         ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG})
-        endif()
-        if (SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE AND NOT SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG)
-            # release and not debug
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-            set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY       ${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE})
-        endif()
-    else()
-        # library not found
-        set(SFML_FOUND FALSE)
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_FOUND FALSE)
-        set(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY "")
-        set(FIND_SFML_MISSING "${FIND_SFML_MISSING} SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY")
-    endif()
-
-    # mark as advanced
-    MARK_AS_ADVANCED(SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DEBUG
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_STATIC_DEBUG
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_RELEASE
-                     SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY_DYNAMIC_DEBUG)
-
-    # add to the global list of libraries
-    set(SFML_LIBRARIES ${SFML_LIBRARIES} "${SFML_${FIND_SFML_COMPONENT_UPPER}_LIBRARY}")
-endforeach()
-
-# in case of static linking, we must also define the list of all the dependencies of SFML libraries
-if(SFML_STATIC_LIBRARIES)
-
-    # detect the OS
-    if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
-        set(FIND_SFML_OS_WINDOWS 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-        set(FIND_SFML_OS_LINUX 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
-        set(FIND_SFML_OS_FREEBSD 1)
-    elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-        set(FIND_SFML_OS_MACOSX 1)
-    endif()
-
-    # start with an empty list
-    set(SFML_DEPENDENCIES)
-    set(FIND_SFML_DEPENDENCIES_NOTFOUND)
-
-    # macro that searches for a 3rd-party library
-    macro(find_sfml_dependency output friendlyname)
-        # No lookup in environment variables (PATH on Windows), as they may contain wrong library versions
-        find_library(${output} NAMES ${ARGN} PATHS ${FIND_SFML_PATHS} PATH_SUFFIXES lib NO_SYSTEM_ENVIRONMENT_PATH)
-        if(${${output}} STREQUAL "${output}-NOTFOUND")
-            unset(output)
-            set(FIND_SFML_DEPENDENCIES_NOTFOUND "${FIND_SFML_DEPENDENCIES_NOTFOUND} ${friendlyname}")
-        endif()
-    endmacro()
-
-    # sfml-system
-    list(FIND SFML_FIND_COMPONENTS "system" FIND_SFML_SYSTEM_COMPONENT)
-    if(NOT ${FIND_SFML_SYSTEM_COMPONENT} EQUAL -1)
-
-        # update the list -- these are only system libraries, no need to find them
-        if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD OR FIND_SFML_OS_MACOSX)
-            set(SFML_SYSTEM_DEPENDENCIES "pthread")
-        endif()
-        if(FIND_SFML_OS_LINUX)
-            set(SFML_SYSTEM_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} "rt")
-        endif()
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_SYSTEM_DEPENDENCIES "winmm")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_SYSTEM_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-network
-    list(FIND SFML_FIND_COMPONENTS "network" FIND_SFML_NETWORK_COMPONENT)
-    if(NOT ${FIND_SFML_NETWORK_COMPONENT} EQUAL -1)
-
-        # update the list -- these are only system libraries, no need to find them
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_NETWORK_DEPENDENCIES "ws2_32")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_NETWORK_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-window
-    list(FIND SFML_FIND_COMPONENTS "window" FIND_SFML_WINDOW_COMPONENT)
-    if(NOT ${FIND_SFML_WINDOW_COMPONENT} EQUAL -1)
-
-        # find libraries
-        if(FIND_SFML_OS_LINUX OR FIND_SFML_OS_FREEBSD)
-            find_sfml_dependency(X11_LIBRARY "X11" X11)
-            find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr)
-        endif()
-
-        if(FIND_SFML_OS_LINUX)
-            find_sfml_dependency(UDEV_LIBRARIES "UDev" udev libudev)
-        endif()
-
-        # update the list
-        if(FIND_SFML_OS_WINDOWS)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "opengl32" "winmm" "gdi32")
-        elseif(FIND_SFML_OS_LINUX)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} ${UDEV_LIBRARIES})
-        elseif(FIND_SFML_OS_FREEBSD)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY} "usbhid")
-        elseif(FIND_SFML_OS_MACOSX)
-            set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon")
-        endif()
-        set(SFML_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-graphics
-    list(FIND SFML_FIND_COMPONENTS "graphics" FIND_SFML_GRAPHICS_COMPONENT)
-    if(NOT ${FIND_SFML_GRAPHICS_COMPONENT} EQUAL -1)
-
-        # find libraries
-        find_sfml_dependency(FREETYPE_LIBRARY "FreeType" freetype)
-
-        # update the list
-        set(SFML_GRAPHICS_DEPENDENCIES ${FREETYPE_LIBRARY})
-        set(SFML_DEPENDENCIES ${SFML_GRAPHICS_DEPENDENCIES} ${SFML_DEPENDENCIES})
-    endif()
-
-    # sfml-audio
-    list(FIND SFML_FIND_COMPONENTS "audio" FIND_SFML_AUDIO_COMPONENT)
-    if(NOT ${FIND_SFML_AUDIO_COMPONENT} EQUAL -1)
-
-        # find libraries
-        find_sfml_dependency(OPENAL_LIBRARY "OpenAL" openal openal32)
-        find_sfml_dependency(OGG_LIBRARY "Ogg" ogg)
-        find_sfml_dependency(VORBIS_LIBRARY "Vorbis" vorbis)
-        find_sfml_dependency(VORBISFILE_LIBRARY "VorbisFile" vorbisfile)
-        find_sfml_dependency(VORBISENC_LIBRARY "VorbisEnc" vorbisenc)
-        find_sfml_dependency(FLAC_LIBRARY "FLAC" FLAC)
-
-        # update the list
-        set(SFML_AUDIO_DEPENDENCIES ${OPENAL_LIBRARY} ${FLAC_LIBRARY} ${VORBISENC_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
-        set(SFML_DEPENDENCIES ${SFML_DEPENDENCIES} ${SFML_AUDIO_DEPENDENCIES})
-    endif()
-
-endif()
-
-# handle errors
-if(NOT SFML_VERSION_OK)
-    # SFML version not ok
-    set(FIND_SFML_ERROR "SFML found but version too low (requested: ${SFML_FIND_VERSION}, found: ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH})")
-    set(SFML_FOUND FALSE)
-elseif(SFML_STATIC_LIBRARIES AND FIND_SFML_DEPENDENCIES_NOTFOUND)
-    set(FIND_SFML_ERROR "SFML found but some of its dependencies are missing (${FIND_SFML_DEPENDENCIES_NOTFOUND})")
-    set(SFML_FOUND FALSE)
-elseif(NOT SFML_FOUND)
-    # include directory or library not found
-    set(FIND_SFML_ERROR "Could NOT find SFML (missing: ${FIND_SFML_MISSING})")
-endif()
-if (NOT SFML_FOUND)
-    if(SFML_FIND_REQUIRED)
-        # fatal error
-        message(FATAL_ERROR ${FIND_SFML_ERROR})
-    elseif(NOT SFML_FIND_QUIETLY)
-        # error but continue
-        message("${FIND_SFML_ERROR}")
-    endif()
-endif()
-
-# handle success
-if(SFML_FOUND AND NOT SFML_FIND_QUIETLY)
-    message(STATUS "Found SFML ${SFML_VERSION_MAJOR}.${SFML_VERSION_MINOR}.${SFML_VERSION_PATCH} in ${SFML_INCLUDE_DIR}")
-endif()


Clean up FindGlog

Clean up FindGlog

--- cmake-modules/FindGlog.cmake
+++ cmake-modules/FindGlog.cmake
@@ -69,14 +69,14 @@

 # Find the libraries
 if(MSVC)
-     _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.lib)
+     _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES glog)
 else(MSVC)
      # Linux/OS X builds
      if(UNIX)
-          _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.so)
+          _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES glog)
      endif(UNIX)
      if(APPLE)
-          _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.dylib)
+          _FIND_GLOG_LIBRARIES(GLOG_LIBRARIES glog)
      endif(APPLE)
 endif(MSVC)


Suppress error message of execute_process

Command 'execute_process' from OpenCVFindMatlab module can omit error message
to the standard output. This can break build of the OpenCV package in
ExternalProject_Add (Windows/Visual Studio).

--- cmake/OpenCVFindMatlab.cmake
+++ cmake/OpenCVFindMatlab.cmake
@@ -94,7 +94,7 @@
     set(REG_EXTENSION_ "SOFTWARE\\Mathworks\\MATLAB")
     set(REG_ROOTS_ "HKEY_LOCAL_MACHINE" "HKEY_CURRENT_USER")
     foreach(REG_ROOT_ ${REG_ROOTS_})
-      execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_)
+      execute_process(COMMAND reg query "${REG_ROOT_}\\${REG_EXTENSION_}" OUTPUT_VARIABLE QUERY_RESPONSE_ ERROR_VARIABLE UNUSED_)
       if (QUERY_RESPONSE_)
         string(REGEX MATCHALL "[0-9]\\.[0-9]" VERSION_STRINGS_ ${QUERY_RESPONSE_})
         list(APPEND VERSIONS_ ${VERSION_STRINGS_})


Complete migration of the include directories as started by mbanck
 in http://opensync.org/changeset/3625/trunk/opensync/CMakeLists.txt.

Regards that this cmake variable is cached so one need to rmove the CMakeCache.txt
before the change is seen by cmake (ie for opensync itself to update its pkg-config file, all plugins, vformat).

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@3626 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e

--- cmake/OpenSyncDefaults.cmake
+++ cmake/OpenSyncDefaults.cmake
@@ -40,7 +40,7 @@

 SET( OPENSYNC_LIBRARIES_DIR "${LIB_INSTALL_DIR}" CACHE PATH "OpenSync library location" )
 SET( OPENSYNC_LIBEXEC_DIR "${LIBEXEC_INSTALL_DIR}/${OPENSYNC_API_DIR}" CACHE PATH "OpenSync libexec location" )
-SET( OPENSYNC_INCLUDE_DIR "${INCLUDE_INSTALL_DIR}/${OPENSYNC_API_DIR}/opensync" CACHE PATH "OpenSync headers location" )
+SET( OPENSYNC_INCLUDE_DIR "${INCLUDE_INSTALL_DIR}/${OPENSYNC_API_DIR}" CACHE PATH "OpenSync headers location" )
 SET( OPENSYNC_DATA_DIR "${SHARE_INSTALL_DIR}/${OPENSYNC_API_DIR}" CACHE PATH "OpenSync data directory" )

 # OpenSync build options:


add suggestion to use catkin_make_isolated for non-homogeneous workspaces

--- cmake/catkin_workspace.cmake
+++ cmake/catkin_workspace.cmake
@@ -86,7 +86,7 @@
       message(FATAL_ERROR "This workspace contains metapackages with a non-standard CMakeLists.txt.")
     endif()
     if(${CATKIN_NONHOMOGENEOUS_WORKSPACE})
-      message(FATAL_ERROR "This workspace contains non-catkin packages in it, and catkin cannot build a non-homogeneous workspace without isolation.")
+      message(FATAL_ERROR "This workspace contains non-catkin packages in it, and catkin cannot build a non-homogeneous workspace without isolation. Try the 'catkin_make_isolated' command instead.")
     endif()

     foreach(index RANGE ${range})


allow flexible CMake minimum version in metapackage CMake code (#1065)

--- cmake/catkin_workspace.cmake
+++ cmake/catkin_workspace.cmake
@@ -64,8 +64,13 @@
         if(EXISTS ${CMAKE_SOURCE_DIR}/${path}/CMakeLists.txt)
           # compare CMakeLists.txt with standard content
           file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt generated_cmakelists)
+          # allow any of CMake minimum version
+          string(REPLACE "2.8.3" "[0-9]+\\.[0-9]+\\.[0-9]+" generated_cmakelists_pattern "${generated_cmakelists}")
+          # need to escape parenthesis
+          string(REPLACE "(" "\\(" generated_cmakelists_pattern "${generated_cmakelists_pattern}")
+          string(REPLACE ")" "\\)" generated_cmakelists_pattern "${generated_cmakelists_pattern}")
           file(STRINGS ${path}/CMakeLists.txt existing_cmakelists)
-          if(NOT "${generated_cmakelists}" STREQUAL "${existing_cmakelists}")
+          if(NOT "${existing_cmakelists}" MATCHES "${generated_cmakelists_pattern}")
             set(CATKIN_NONHOMOGENEOUS_WORKSPACE TRUE)
             message("WARNING: The CMakeLists.txt of the metapackage '${name}' contains non standard content. Use the content of the following file instead: ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt")
           endif()


Fixes add_chimera_binding() to inherit target properties. (#159)

This commit fixes the issue originally raised in #113 where build options for the chimera binding target were not propagated to the placeholder target used in binding generation.

The fix makes use of generator expressions to directly insert the properties for the target into the properties of the placeholder. This works for compile options, include directories, and link
libraries, but I don't know if it works quite correctly with transitive dependencies directly on other CMake targets.

--- cmake/chimeraFunctions.cmake
+++ cmake/chimeraFunctions.cmake
@@ -15,11 +15,7 @@
 #                     [NAMESPACES namespace1 namespace2 ...])
 #                     SOURCES source1_file [source2_file ...]
 #                     [EXTRA_SOURCES source1_file ...]
-#                     [LINK_LIBRARIES item1 [item2 [...]]]
 #                     [DEBUG] [EXCLUDE_FROM_ALL]
-#
-# Warning: LINK_LIBRARIES option is a temporary feature and can be removed any
-# time. See #113 for further information.
 function(add_chimera_binding)
     include(ExternalProject)

@@ -73,17 +69,20 @@
         foreach(source ${binding_EXTRA_SOURCES})
             message(STATUS "  - ${source}")
         endforeach()
-        message(STATUS "  Link Libraries:")
-        foreach(library ${binding_LINK_LIBRARIES})
-            message(STATUS "  - ${library}")
-        endforeach()
     endif()

     # Ensure that the output destination directory is created.
     file(MAKE_DIRECTORY "${binding_DESTINATION}")
     set(binding_SOURCES_TXT "${binding_DESTINATION}/sources.txt")
     set(binding_EMPTY_CPP "${binding_DESTINATION}/empty.cpp")
-    file(WRITE "${binding_EMPTY_CPP}" "")
+    file(WRITE "${binding_EMPTY_CPP}"
+      "/// ==================================================================\n"
+      "/// AUTOGENERATED BY CHIMERA - DO NOT EDIT\n"
+      "///\n"
+      "/// This file is used as a placeholder during the Chimera CMake build.\n"
+      "/// It is intentionally generated without contents.\n"
+      "/// ==================================================================\n"
+    )

     # Construct the list of chimera arguments.
     set(binding_ARGS)
@@ -136,7 +135,16 @@
         ${binding_SOURCES}
     )
     target_link_libraries("${binding_TARGET}_placeholder"
-        ${binding_LINK_LIBRARIES}
+        $<TARGET_PROPERTY:${binding_TARGET},LINK_LIBRARIES>
+    )
+    target_include_directories("${binding_TARGET}_placeholder" SYSTEM PUBLIC
+        $<TARGET_PROPERTY:${binding_TARGET},INCLUDE_DIRECTORIES>
+    )
+    target_compile_options("${binding_TARGET}_placeholder" PUBLIC
+        $<TARGET_PROPERTY:${binding_TARGET},COMPILE_OPTIONS>
+    )
+    target_compile_definitions("${binding_TARGET}_placeholder" PUBLIC
+        $<TARGET_PROPERTY:${binding_TARGET},COMPILE_DEFINITIONS>
     )
     set_target_properties("${binding_TARGET}_placeholder" PROPERTIES
         LINKER_LANGUAGE CXX


build: fix parameter name in cmake

build: fix parameter name in cmake

Fix the parameter name in `_add_swift_library_single` which would
previously not pass any value for the `INSTALL_IN_COMPONENT` due to a
missed alteration when the function was refactored.  Spotted by
inspection.

--- cmake/modules/AddSwift.cmake
+++ cmake/modules/AddSwift.cmake
@@ -866,7 +866,7 @@
       ${SWIFTLIB_SINGLE_IS_STDLIB_CORE_keyword}
       ${SWIFTLIB_SINGLE_IS_SDK_OVERLAY_keyword}
       ${embed_bitcode_arg}
-      INSTALL_IN_COMPONENT "${SWIFTLIB_INSTALL_IN_COMPONENT}")
+      INSTALL_IN_COMPONENT "${SWIFTLIB_SINGLE_INSTALL_IN_COMPONENT}")
   add_swift_source_group("${SWIFTLIB_SINGLE_EXTERNAL_SOURCES}")

   # If there were any swift sources, then a .swiftmodule may have been created.


Make cabal settings a lot faster

Make cabal settings a lot faster

--- lib/FindCabal.cmake
+++ lib/FindCabal.cmake
@@ -3,7 +3,7 @@

 IF (CABAL_EXECUTABLE)
     EXECUTE_PROCESS(
-        COMMAND cabal list
+        COMMAND cabal list nothing
         OUTPUT_QUIET
         ERROR_VARIABLE out
     )


Fix on-demand build for Maven libraries.

--- third_party/maven_libraries.cmake
+++ third_party/maven_libraries.cmake
@@ -25,6 +25,9 @@
       ${TARGET} PROPERTIES JAR_FILE "${ARTIFACT_ID}-${VERSION}.jar")
   set_target_properties(
       ${TARGET} PROPERTIES VERSION "${VERSION}")
+  if (NOT "$ENV{BUILD_3RD_PARTY_LIBRARIES}")
+    return ()
+  endif ()
   add_dependencies(${TARGET} ${MAVEN_LIBS_TARGET})
 endfunction(maven_library)


NEW: Allow to pass translation configuration

--- examples/himeno/Makefile.cmake
+++ examples/himeno/Makefile.cmake
@@ -1,4 +1,5 @@
-PHYSISC = @CMAKE_INSTALL_PREFIX@/bin/physisc -DENABLE_DUMP
+PHYSISC_CONFIG ?= /dev/null
+PHYSISC = @CMAKE_INSTALL_PREFIX@/bin/physisc -DENABLE_DUMP --config $(PHYSISC_CONFIG)
 PHYSIS_INCLUDE = -I@CMAKE_INSTALL_PREFIX@/include
 CFLAGS = -Wall -g $(PHYSIS_INCLUDE) -O2 -DENABLE_DUMP
 NVCC_CFLAGS = -g -Xcompiler -Wall $(PHYSIS_INCLUDE) -arch sm_20 -DENABLE_DUMP


hdf5: Disable hdf5 library name encoding

--- config/cmake/HDFMacros.cmake
+++ config/cmake/HDFMacros.cmake
@@ -315,23 +315,7 @@
     ENDIF (WIN32 AND NOT MINGW)
   ENDIF (${libtype} MATCHES "SHARED")

-  SET_TARGET_PROPERTIES (${libtarget}
-      PROPERTIES
-      DEBUG_OUTPUT_NAME          ${LIB_DEBUG_NAME}
-      RELEASE_OUTPUT_NAME        ${LIB_RELEASE_NAME}
-      MINSIZEREL_OUTPUT_NAME     ${LIB_RELEASE_NAME}
-      RELWITHDEBINFO_OUTPUT_NAME ${LIB_RELEASE_NAME}
-  )
-
-  #----- Use MSVC Naming conventions for Shared Libraries
-  IF (MINGW AND ${libtype} MATCHES "SHARED")
-    SET_TARGET_PROPERTIES (${libtarget}
-        PROPERTIES
-        IMPORT_SUFFIX ".lib"
-        IMPORT_PREFIX ""
-        PREFIX ""
-    )
-  ENDIF (MINGW AND ${libtype} MATCHES "SHARED")
+  # library names not mangled in this reduced distribution

 ENDMACRO (HDF_SET_LIB_OPTIONS)


Do not throw errors when glfw is not required and could not be found

--- cmake_modules/FindGLFW.cmake
+++ cmake_modules/FindGLFW.cmake
@@ -56,9 +56,7 @@
                             $ENV{GLFWDIR}
 )

-IF(NOT GLFW_INCLUDE_DIR)
-    MESSAGE(SEND_ERROR "glfw.h not found")
-ELSE()
+IF(GLFW_INCLUDE_DIR)
     IF(EXISTS ${GLFW_INCLUDE_DIR}/GL/glfw.h)
         SET(GLFW_INCLUDE_FILE "glfw.h")
     ELSE()
@@ -66,12 +64,11 @@
             SET(GLFW_INCLUDE_FILE "glfw3.h")
         ENDIF()
     ENDIF()
-ENDIF()

-# check the version number
-SET(GLFW_VERSION_OK TRUE)
-# GLFW_FIND_VERSION AND
-IF(GLFW_INCLUDE_DIR)
+    # check the version number
+    SET(GLFW_VERSION_OK TRUE)
+    # GLFW_FIND_VERSION AND
+
     # extract the major and minor version numbers from GL/glfw.h
     FILE(STRINGS "${GLFW_INCLUDE_DIR}/GL/${GLFW_INCLUDE_FILE}" GLFW_H REGEX "^.*API version: .*$")

@@ -95,36 +92,36 @@
 #             set(GLFW_VERSION_OK FALSE)
 #         endif()
 #     endif()
-ENDIF()

-FIND_LIBRARY(GLFW_LIBRARY   NAMES glfw glfw3
-                            PATHS
-                            ~/Library/Frameworks
-                            /Library/Frameworks
-                            /usr/local
-                            /usr/local/X11R6
-                            /usr/X11R6
-                            /usr/X11
-                            /usr/lib/X11
-                            /usr
-                            /opt/local
-                            /opt/csw
-                            /opt/X11
-                            /opt
-                            /sw
-                            $ENV{GLFWDIR}/support/msvc80/Debug
-                            $ENV{GLFWDIR}/support/msvc80/Release
-                            ${VS_DIR}/VC/lib
-                            ${GLFWDIR}
-                            $ENV{GLFWDIR}
-)
+    FIND_LIBRARY(GLFW_LIBRARY   NAMES glfw glfw3
+                                PATHS
+                                ~/Library/Frameworks
+                                /Library/Frameworks
+                                /usr/local
+                                /usr/local/X11R6
+                                /usr/X11R6
+                                /usr/X11
+                                /usr/lib/X11
+                                /usr
+                                /opt/local
+                                /opt/csw
+                                /opt/X11
+                                /opt
+                                /sw
+                                $ENV{GLFWDIR}/support/msvc80/Debug
+                                $ENV{GLFWDIR}/support/msvc80/Release
+                                ${VS_DIR}/VC/lib
+                                ${GLFWDIR}
+                                $ENV{GLFWDIR}
+    )

-IF(NOT GLFW_LIBRARY)
-    MESSAGE(SEND_ERROR "libglfw not found")
-ENDIF()
-
-IF(GLFW_INCLUDE_DIR AND GLFW_LIBRARY)
-    SET(GLFW_FOUND TRUE)
+    IF(GLFW_LIBRARY)
+        SET(GLFW_FOUND TRUE)
+    ELSE()
+        MESSAGE("libglfw[3] could not be found")
+    ENDIF()
+ELSE()
+    MESSAGE("glfw.h and glfw3.h could not be found")
 ENDIF()

 IF(GLFW_FOUND)


idl-config: Add the idl file as dependency to generated files.

Change-Id: I80b355446c036e318a7bb9682b24258880871aeb
Reviewed-on: http://gerrit.aldebaran.lan:8080/17164
Reviewed-by: mnottale <e3ccf1b6558404e921a21fa09cebb1153b50ec36@aldebaran-robotics.com>
Tested-by: mnottale <e3ccf1b6558404e921a21fa09cebb1153b50ec36@aldebaran-robotics.com>

--- codegen/src/idl-config.cmake
+++ codegen/src/idl-config.cmake
@@ -150,7 +150,7 @@
   if (ARG_PROXY)
     qi_generate_src(
       ${CMAKE_CURRENT_BINARY_DIR}/${name}_proxy.hpp
-      SRC ${ARG_SRC} ${ARG_DOXYSRC}
+      SRC ${ARG_SRC} ${ARG_DOXYSRC} ${IDL}
       COMMAND ${_python_executable} ${IDLPY}
         ${IDL}
         "${classes}"
@@ -175,7 +175,7 @@
        string(TOLOWER ${c} cl)
        qi_generate_src(
        ${CMAKE_CURRENT_BINARY_DIR}/${cl}_bind.cpp
-       SRC ${ARG_SRC} ${ARG_DOXYSRC}
+       SRC ${ARG_SRC} ${ARG_DOXYSRC} ${IDL}
        COMMAND ${_python_executable} ${IDLPY}
          ${IDL}
          ${kclasses}
@@ -190,7 +190,7 @@
       string(TOLOWER ${c} cl)
       qi_generate_src(
       ${CMAKE_CURRENT_BINARY_DIR}/${cl}_bind.cpp
-      SRC ${ARG_SRC} ${ARG_DOXYSRC}
+      SRC ${ARG_SRC} ${ARG_DOXYSRC} ${IDL}
       COMMAND ${_python_executable} ${IDLPY}
         ${IDL}
         ${kclasses}
@@ -215,7 +215,7 @@
     message("carg: '${carg}'")
     qi_generate_src(
        ${CMAKE_CURRENT_BINARY_DIR}/${name}_bind.cpp
-       SRC ${ARG_SRC} ${ARG_DOXYSRC}
+       SRC ${ARG_SRC} ${ARG_DOXYSRC} ${IDL}
        COMMAND ${_python_executable} ${IDLPY}
          ${IDL}
          ${kclasses}
@@ -229,7 +229,7 @@
   # Generate interface
   qi_generate_src(
      ${CMAKE_CURRENT_BINARY_DIR}/${name}_interface.hpp
-     SRC ${ARG_SRC} ${ARG_DOXYSRC}
+     SRC ${ARG_SRC} ${ARG_DOXYSRC} ${IDL}
      COMMAND ${_python_executable} ${IDLPY}
        ${IDL}
        ${classes}


Take out absolute path to PowerPC compiler.

--- linux/ppc_gcc.cmake
+++ linux/ppc_gcc.cmake
@@ -1,6 +1,6 @@
 # this one is important
 SET(CMAKE_SYSTEM_NAME Linux)

-SET(CMAKE_C_COMPILER "/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux/powerpc-poky-linux-gcc")
-SET(CMAKE_CXX_COMPILER "/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/powerpc-poky-linux/powerpc-poky-linux-g++")
+SET(CMAKE_C_COMPILER powerpc-poky-linux-gcc)
+SET(CMAKE_CXX_COMPILER powerpc-poky-linux-g++)


Build without exceptions and rtti on GCC and Clang

--- cmake/CompileOptions.cmake
+++ cmake/CompileOptions.cmake
@@ -91,6 +91,9 @@
 # GCC and Clang compiler options
 if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
     set(DEFAULT_COMPILE_OPTIONS ${DEFAULT_COMPILE_OPTIONS}
+        -fno-exceptions
+        -fno-rtti
+
         -Wall
         -Wextra
         -Wunused


cmake: set the CPACK_DEBIAN_PACKAGE_ARCHITECTURE for old versions of Cmake

Old versions (2.8.12) of cmake don't automatically set the debian package architecture.

This causes  dpkg errors like:
dpkg: warning: parsing file '/var/lib/dpkg/tmp.ci/control' near line 10 package 'libiio':
 empty value for architecture
dpkg: error processing archive ./master_latest_libiio-trusty.deb (--install):
 package architecture () does not match system (amd64)

This resolved that error by automatically setting it for old (pre 3) cmakes.

Signed-off-by: Robin Getz <c66e5a86ef9317cf35cecb2ed063996b2100ed4b@analog.com>

--- cmake/LinuxPackaging.cmake
+++ cmake/LinuxPackaging.cmake
@@ -109,4 +109,17 @@
 	message(STATUS "Package dependencies (.rpm): " ${CPACK_RPM_PACKAGE_REQUIRES})
 endif()

+if(${CMAKE_MAJOR_VERSION} LESS 3)
+	# old versions of cmake dont include this, but the same vintage of dpkg requires it
+	IF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+		FIND_PROGRAM(DPKG_CMD dpkg)
+		IF(NOT DPKG_CMD)
+			MESSAGE(STATUS "Can not find dpkg in your path, default to i386.")
+			SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
+		ENDIF(NOT DPKG_CMD)
+		EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture
+			OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
+			OUTPUT_STRIP_TRAILING_WHITESPACE)
+	ENDIF(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+endif()
 include(CPack)


Version information cached

Version information cached

--- cmake/MyPackageStart.cmake
+++ cmake/MyPackageStart.cmake
@@ -5,16 +5,11 @@
   PROJECT (${packageName} VERSION ${versionMajor}.${versionMinor}.${versionPatch} LANGUAGES C CXX)  # This is setting PROJECT_NAME -;
   MESSAGE (STATUS "[${PROJECT_NAME}-START-STATUS] Starting version ${versionMajor}.${versionMinor}.${versionPatch}")
   STRING (TOUPPER ${PROJECT_NAME} _PROJECTNAME)
-  SET (${_PROJECTNAME}_VERSION_MAJOR ${versionMajor})
-  SET (${_PROJECTNAME}_VERSION_MINOR ${versionMinor})
-  SET (${_PROJECTNAME}_VERSION_PATCH ${versionPatch})
-  SET (${_PROJECTNAME}_VERSION "${${_PROJECTNAME}_VERSION_MAJOR}.${${_PROJECTNAME}_VERSION_MINOR}.${${_PROJECTNAME}_VERSION_PATCH}")
-  MARK_AS_ADVANCED(
-    ${_PROJECTNAME}_VERSION_MAJOR
-    ${_PROJECTNAME}_VERSION_MINOR
-    ${_PROJECTNAME}_VERSION_PATH
-    ${_PROJECTNAME}_VERSION
-    )
+  SET (${_PROJECTNAME}_VERSION_MAJOR ${versionMajor} CACHE STRING "${PROJECT_NAME} major version")
+  SET (${_PROJECTNAME}_VERSION_MINOR ${versionMinor} CACHE STRING "${PROJECT_NAME} minor version")
+  SET (${_PROJECTNAME}_VERSION_PATCH ${versionPatch} CACHE STRING "${PROJECT_NAME} patch version")
+  SET (${_PROJECTNAME}_VERSION "${${_PROJECTNAME}_VERSION_MAJOR}.${${_PROJECTNAME}_VERSION_MINOR}.${${_PROJECTNAME}_VERSION_PATCH}"
+     CACHE STRING "${PROJECT_NAME} version")
   #
   # Options
   #


fixed overlaying message generators, since they are already find_package()-ed by genmsg before being processed according to the topological order

--- cmake/catkin_project.cmake
+++ cmake/catkin_project.cmake
@@ -104,6 +104,11 @@
     message(FATAL_ERROR "catkin_project() called with unused arguments: ${PROJECT_DEFAULT_ARGS}")
   endif()

+  # unset previously found directory of this project, so that this project overlays the other cleanly
+  if(${PROJECT_NAME}_DIR)
+    set(${PROJECT_NAME}_DIR "" CACHE PATH "" FORCE)
+  endif()
+
   # filter out DEPENDS which have not been find_package()-ed before
   foreach(depend ${PROJECT_DEPENDS})
     if(NOT ${depend}_FOUND)


Update compiler_flags.cmake

Update compiler_flags.cmake

CXX

--- cmake/compiler_flags.cmake
+++ cmake/compiler_flags.cmake
@@ -152,7 +152,7 @@
   string(FIND "${CMAKE_CXX_FLAGS}" "${preproc_def}" PREPROC_DEF_FOUND)

   if (${PREPROC_DEF_FOUND} EQUAL -1)
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${preproc_def}" CACHE STRING ""
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${preproc_def}" CACHE STRING ""
         FORCE)
   endif ()
 endfunction ()


use the bj as default address instead of cdn test=develop (#17795)

The cdn.bcebos.com can be unstable randomly for unknown reason, restore it to bj.bcebos.com.

--- cmake/external/mklml.cmake
+++ cmake/external/mklml.cmake
@@ -34,7 +34,7 @@
 SET(TIME_VERSION "2019.0.1.20181227")
 IF(WIN32)
     SET(MKLML_VER "mklml_win_${TIME_VERSION}" CACHE STRING "" FORCE)
-    SET(MKLML_URL "https://paddlepaddledeps.cdn.bcebos.com/${MKLML_VER}.zip" CACHE STRING "" FORCE)
+    SET(MKLML_URL "https://paddlepaddledeps.bj.bcebos.com/${MKLML_VER}.zip" CACHE STRING "" FORCE)
     SET(MKLML_LIB                 ${MKLML_LIB_DIR}/mklml.lib)
     SET(MKLML_IOMP_LIB            ${MKLML_LIB_DIR}/libiomp5md.lib)
     SET(MKLML_SHARED_LIB          ${MKLML_LIB_DIR}/mklml.dll)


fix signing and packaging

fix signing and packaging

--- cmake/install_macros.cmake
+++ cmake/install_macros.cmake
@@ -36,7 +36,9 @@
       STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
     ENDIF()
     IF(target STREQUAL "mysqld")
-	  SET(comp Server)
+      SET(comp Server)
+    ELSEIF(pdb_location MATCHES "mysql-test")
+      SET(comp Tests)
     ELSE()
       SET(comp Debuginfo)
     ENDIF()
@@ -78,7 +80,6 @@
     ELSE()
       SET(SECTION man8)
     ENDIF()
-    MESSAGE("huj!")
     INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
       COMPONENT ManPages)
   ENDIF()
@@ -150,34 +151,26 @@
    SET(SIGNTOOL_PARAMETERS
      /a /t http://timestamp.verisign.com/scripts/timstamp.dll
      CACHE STRING "parameters for signtool (list)")
-    FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool)
+    FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
+      PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
+      "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86"
+    )
     IF(NOT SIGNTOOL_EXECUTABLE)
       MESSAGE(FATAL_ERROR
       "signtool is not found. Signing executables not possible")
     ENDIF()
-    IF(NOT DEFINED SIGNCODE_ENABLED)
-      FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}")
-      MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/testsign)
-     TRY_COMPILE(RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c
-      COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
-     )
-
-     EXECUTE_PROCESS(COMMAND
-      ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
-      RESULT_VARIABLE ERR ERROR_QUIET OUTPUT_QUIET
-      )
-      IF(ERR EQUAL 0)
-       SET(SIGNCODE_ENABLED 1 CACHE INTERNAL "Can sign executables")
-      ELSE()
-       MESSAGE(STATUS "Disable authenticode signing for executables")
-        SET(SIGNCODE_ENABLED 0 CACHE INTERNAL "Invalid or missing certificate")
-      ENDIF()
-    ENDIF()
     MARK_AS_ADVANCED(SIGNTOOL_EXECUTABLE  SIGNTOOL_PARAMETERS)
   ENDIF()
 ENDIF()

-MACRO(SIGN_TARGET target)
+MACRO(SIGN_TARGET)
+ MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
+ SET(target ${ARG_DEFAULT_ARGS})
+ IF(ARG_COMPONENT)
+  SET(comp COMPONENT ${ARG_COMPONENT})
+ ELSE()
+  SET(comp)
+ ENDIF()
  GET_TARGET_PROPERTY(target_type ${target} TYPE)
  IF(target_type AND NOT target_type MATCHES "STATIC")
    GET_TARGET_PROPERTY(target_location ${target}  LOCATION)
@@ -187,12 +180,17 @@
    ENDIF()
    INSTALL(CODE
    "EXECUTE_PROCESS(COMMAND
-     ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${target_location}
+   \"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\"
+   RESULT_VARIABLE ERR)
+   IF(NOT \${ERR} EQUAL 0)
+     EXECUTE_PROCESS(COMMAND
+     \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\"
      RESULT_VARIABLE ERR)
-    IF(NOT \${ERR} EQUAL 0)
-      MESSAGE(FATAL_ERROR \"Error signing  ${target_location}\")
-    ENDIF()
-   ")
+   ENDIF()
+   IF(NOT \${ERR} EQUAL 0)
+    MESSAGE(FATAL_ERROR \"Error signing  '${target_location}'\")
+   ENDIF()
+   " ${comp})
  ENDIF()
 ENDMACRO()

@@ -207,6 +205,10 @@
   ""
   ${ARGN}
   )
+  IF(ARG_COMPONENT)
+    SET(COMP COMPONENT ${ARG_COMPONENT})
+  ENDIF()
+
   SET(TARGETS ${ARG_DEFAULT_ARGS})
   IF(NOT TARGETS)
     MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS")
@@ -218,8 +220,8 @@

   FOREACH(target ${TARGETS})
     # If signing is required, sign executables before installing
-     IF(SIGNCODE AND SIGNCODE_ENABLED)
-      SIGN_TARGET(${target})
+     IF(SIGNCODE)
+      SIGN_TARGET(${target} ${COMP})
     ENDIF()
     # Install man pages on Unix
     IF(UNIX)
@@ -227,9 +229,7 @@
       INSTALL_MANPAGE(${target_location})
     ENDIF()
   ENDFOREACH()
-  IF(ARG_COMPONENT)
-    SET(COMP COMPONENT ${ARG_COMPONENT})
-  ENDIF()
+
   INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP})
   SET(INSTALL_LOCATION ${ARG_DESTINATION} )
   INSTALL_DEBUG_SYMBOLS("${TARGETS}")


Changed the CMake build system logic again for finding finite, isnan and isinf functions. Tested with Visual C++ and MinGW on Win32.

svn path=/trunk/; revision=9663

--- cmake/modules/plplot.cmake
+++ cmake/modules/plplot.cmake
@@ -202,63 +202,75 @@
 # Check for FP functions, including underscored version which
 # are sometimes all that is available on windows

-
-check_symbol_exists(finite "math.h" HAVE_FINITE)
-if(NOT HAVE_FINITE)
-  check_function_exists(finite HAVE_FINITE2)
-  if(HAVE_FINITE2)
-    set(HAVE_FINITE ${HAVE_FINITE2} CACHE INTERNAL "Have function finite")
-  else(HAVE_FINITE2)
-    check_symbol_exists(_finite "math.h" _HAVE_FINITE)
-    if(NOT _HAVE_FINITE)
-      check_function_exists(_finite _HAVE_FINITE2)
-      if(_HAVE_FINITE2)
-        set(_HAVE_FINITE ${_HAVE_FINITE2} CACHE INTERNAL "Have function _finite")
-        set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function _finite")
-      endif(_HAVE_FINITE2)
-      set(_HAVE_FINITE2 "" CACHE INTERNAL "Have function _finite")
-    endif(NOT _HAVE_FINITE)
-  endif(HAVE_FINITE2)
-  set(HAVE_FINITE2 "" CACHE INTERNAL "Have function finite")
-endif(NOT HAVE_FINITE)
-
-check_symbol_exists(isnan "math.h" HAVE_ISNAN)
-if(NOT HAVE_ISNAN)
-  check_function_exists(isnan HAVE_ISNAN2)
-  if(HAVE_ISNAN2)
-    set(HAVE_ISNAN ${HAVE_ISNAN2} CACHE INTERNAL "Have function isnan")
-  else(HAVE_ISNAN2)
-    check_symbol_exists(_isnan "math.h" _HAVE_ISNAN)
-    if(NOT _HAVE_ISNAN)
-      check_function_exists(_isnan _HAVE_ISNAN2)
-      if(_HAVE_ISNAN2)
-        set(_HAVE_ISNAN ${_HAVE_ISNAN2} CACHE INTERNAL "Have function _isnan")
-        set(HAVE_ISNAN ${_HAVE_ISNAN} CACHE INTERNAL "Have function _isnan")
-      endif(_HAVE_ISNAN2)
-      set(_HAVE_ISNAN2 "" CACHE INTERNAL "Have function _isnan")
-    endif(NOT _HAVE_ISNAN)
-  endif(HAVE_ISNAN2)
-  set(HAVE_ISNAN2 "" CACHE INTERNAL "Have function isnan")
-endif(NOT HAVE_ISNAN)
-
-check_symbol_exists(ising "math.h" HAVE_ISINF)
-if(NOT HAVE_ISINF)
-  check_function_exists(ising HAVE_ISINF2)
-  if(HAVE_ISINF2)
-    set(HAVE_ISINF ${HAVE_ISINF2} CACHE INTERNAL "Have function ising")
-  else(HAVE_ISINF2)
-    check_symbol_exists(_ising "math.h" _HAVE_ISINF)
-    if(NOT _HAVE_ISINF)
-      check_function_exists(_ising _HAVE_ISINF2)
-      if(_HAVE_ISINF2)
-        set(_HAVE_ISINF ${_HAVE_ISINF2} CACHE INTERNAL "Have function _ising")
-        set(HAVE_ISINF ${_HAVE_ISINF} CACHE INTERNAL "Have function _ising")
-      endif(_HAVE_ISINF2)
-      set(_HAVE_ISINF2 "" CACHE INTERNAL "Have function _ising")
-    endif(NOT _HAVE_ISINF)
-  endif(HAVE_ISINF2)
-  set(HAVE_ISINF2 "" CACHE INTERNAL "Have function ising")
-endif(NOT HAVE_ISINF)
+check_symbol_exists(finite "math.h" HAVE_FINITE_SYMBOL)
+if(HAVE_FINITE_SYMBOL)
+  set(HAVE_FINITE ON)
+else(HAVE_FINITE_SYMBOL)
+  check_function_exists(finite HAVE_FINITE_FUNCTION)
+  if(HAVE_FINITE_FUNCTION)
+    set(HAVE_FINITE ON)
+  else(HAVE_FINITE_FUNCTION)
+    check_symbol_exists(_finite "math.h" HAVE__FINITE_SYMBOL)
+    if(HAVE__FINITE_SYMBOL)
+      set(_HAVE_FINITE ON)
+    else(HAVE__FINITE_SYMBOL)
+      check_function_exists(_finite HAVE__FINITE_FUNCTION)
+      if(HAVE__FINITE_FUNCTION)
+        set(_HAVE_FINITE ON)
+      endif(HAVE__FINITE_FUNCTION)
+    endif(HAVE__FINITE_SYMBOL)
+  endif(HAVE_FINITE_FUNCTION)
+endif(HAVE_FINITE_SYMBOL)
+if(_HAVE_FINITE)
+  set(HAVE_FINITE ON)
+endif(_HAVE_FINITE)
+
+check_symbol_exists(isnan "math.h" HAVE_ISNAN_SYMBOL)
+if(HAVE_ISNAN_SYMBOL)
+  set(HAVE_ISNAN ON)
+else(HAVE_ISNAN_SYMBOL)
+  check_function_exists(isnan HAVE_ISNAN_FUNCTION)
+  if(HAVE_ISNAN_FUNCTION)
+    set(HAVE_ISNAN ON)
+  else(HAVE_ISNAN_FUNCTION)
+    check_symbol_exists(_isnan "math.h" HAVE__ISNAN_SYMBOL)
+    if(HAVE__ISNAN_SYMBOL)
+      set(_HAVE_ISNAN ON)
+    else(HAVE__ISNAN_SYMBOL)
+      check_function_exists(_isnan HAVE__ISNAN_FUNCTION)
+      if(HAVE__ISNAN_FUNCTION)
+        set(_HAVE_ISNAN ON)
+      endif(HAVE__ISNAN_FUNCTION)
+    endif(HAVE__ISNAN_SYMBOL)
+  endif(HAVE_ISNAN_FUNCTION)
+endif(HAVE_ISNAN_SYMBOL)
+if(_HAVE_ISNAN)
+  set(HAVE_ISNAN ON)
+endif(_HAVE_ISNAN)
+
+check_symbol_exists(isinf "math.h" HAVE_ISINF_SYMBOL)
+if(HAVE_ISINF_SYMBOL)
+  set(HAVE_ISINF ON)
+else(HAVE_ISINF_SYMBOL)
+  check_function_exists(isinf HAVE_ISINF_FUNCTION)
+  if(HAVE_ISINF_FUNCTION)
+    set(HAVE_ISINF ON)
+  else(HAVE_ISINF_FUNCTION)
+    check_symbol_exists(_isinf "math.h" HAVE__ISINF_SYMBOL)
+    if(HAVE__ISINF_SYMBOL)
+      set(_HAVE_ISINF ON)
+    else(HAVE__ISINF_SYMBOL)
+      check_function_exists(_isinf HAVE__ISINF_FUNCTION)
+      if(HAVE__ISINF_FUNCTION)
+        set(_HAVE_ISINF ON)
+      endif(HAVE__ISINF_FUNCTION)
+    endif(HAVE__ISINF_SYMBOL)
+  endif(HAVE_ISINF_FUNCTION)
+endif(HAVE_ISINF_SYMBOL)
+if(_HAVE_ISINF)
+  set(HAVE_ISINF ON)
+endif(_HAVE_ISINF)
+

 check_function_exists(snprintf PL_HAVE_SNPRINTF)
 if(NOT PL_HAVE_SNPRINTF)


fixed zeromq compilation problem

fixed zeromq compilation problem

--- cmake/modules/zeromq.cmake
+++ cmake/modules/zeromq.cmake
@@ -42,7 +42,7 @@
             INSTALL_COMMAND cp ${THIRDPARTY_DIR}/src/cppzmq/zmq.hpp ${PROJECT_BINARY_DIR}/include/zmq.hpp
         )
         list(APPEND external_project_dependencies cppzmq)
-        add_dependencies(cppzmq libzmq)
+
     endif(NOT ZMQ_INCLUDE_DIR)
     if(NOT ZMQ_LIBRARY)
         ExternalProject_Add(
@@ -55,12 +55,13 @@
             CMAKE_ARGS -DZMQ_BUILD_TESTS=OFF
         )
         list(APPEND external_project_dependencies libzmq)
+        add_dependencies(cppzmq libzmq)
     endif(NOT ZMQ_LIBRARY)
     set(ZMQ_INCLUDE_DIR "${PROJECT_BINARY_DIR}/include")
     if(WIN32)
         set(ZMQ_LIBRARY "${PROJECT_BINARY_DIR}/lib/libzmq.lib")
     else(WIN32)
-        set(ZMQ_LIBRARY "${PROJECT_BINARY_DIR}/lib/libzmq.so")
+        set(ZMQ_LIBRARY "${PROJECT_BINARY_DIR}/lib/libzmq-static.a")
     endif(WIN32)
     message (STATUS "  (Headers should be)       ${ZMQ_INCLUDE_DIR}")
     message (STATUS "  (Library should be)       ${ZMQ_LIBRARY}")


Changed boost version from 1.42 back to 1.40

git-svn-id: 5398946ba177a3e438c2dae55e2cdfc2fb96c905@711 a9d63959-f2ad-4865-b262-bf0e56cfafb6

--- cmake/pcl_find_boost.cmake
+++ cmake/pcl_find_boost.cmake
@@ -4,7 +4,7 @@
     set(Boost_USE_STATIC_LIBS ON)
 endif(NOT PCL_SHARED_LIBS)

-find_package(Boost 1.42.0 COMPONENTS system filesystem thread date_time)
+find_package(Boost 1.40.0 COMPONENTS system filesystem thread date_time)

 include_directories(${Boost_INCLUDE_DIRS})
 link_directories(${Boost_LIBRARY_DIRS})


try thread if future failed

try thread if future failed

--- cmake/vSMCFindSTDTBB.cmake
+++ cmake/vSMCFindSTDTBB.cmake
@@ -19,6 +19,7 @@
         SET (CMAKE_REQUIRED_DEFINITIONS ${SAFE_CMAKE_REQUIRED_DEFINITIONS})
     ENDIF (VSMC_TRY_FUTURE)
     IF (NOT VSMC_STD_FOUND)
+        UNSET (VSMC_STDTBB_FOUND CACHE)
         CHECK_CXX_SOURCE_RUNS ("${VSMC_STDTBB_TEST_SOURCE}" VSMC_STDTBB_FOUND)
     ENDIF (NOT VSMC_STD_FOUND)
     IF (VSMC_STDTBB_FOUND)