cmake nuttx build use full path to copy stamp

 - fixes #6469

--- cmake/nuttx/px4_impl_nuttx.cmake
+++ cmake/nuttx/px4_impl_nuttx.cmake
@@ -256,15 +256,15 @@
 	# copy
 	file(GLOB_RECURSE nuttx_all_files ${PX4_SOURCE_DIR}/NuttX/*)
 	file(RELATIVE_PATH nuttx_cp_src ${PX4_BINARY_DIR} ${PX4_SOURCE_DIR}/NuttX)
-	add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp
+	add_custom_command(OUTPUT ${PX4_BINARY_DIR}/nuttx_copy_${CONFIG}.stamp
 		COMMAND ${MKDIR} -p ${nuttx_src}
 		COMMAND rsync -a --delete --exclude=.git ${nuttx_cp_src}/ ${CONFIG}/NuttX/
-		COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp
+		COMMAND ${TOUCH} ${PX4_BINARY_DIR}/nuttx_copy_${CONFIG}.stamp
 		DEPENDS ${DEPENDS} ${nuttx_patches} ${nuttx_all_files}
 		COMMENT "Copying NuttX for ${CONFIG} with ${config_nuttx_config}"
 		WORKING_DIRECTORY ${PX4_BINARY_DIR}
 		)
-	add_custom_target(nuttx_copy_${CONFIG} DEPENDS nuttx_copy_${CONFIG}.stamp)
+	add_custom_target(nuttx_copy_${CONFIG} DEPENDS ${PX4_BINARY_DIR}/nuttx_copy_${CONFIG}.stamp)

 	# patch
 	add_custom_target(nuttx_patch_${CONFIG})


luajit.cmake: Attempt to port LUAJIT_UNWIND_EXTERNAL logic from luajit's src/Makefile

--- deps/luajit.cmake
+++ deps/luajit.cmake
@@ -73,7 +73,6 @@
 if ( WIN32 AND NOT CYGWIN )
   set ( LJVM_MODE peobj )
 elseif ( APPLE )
-  set ( CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000 ${CMAKE_EXE_LINKER_FLAGS}" )
   set ( LJVM_MODE machasm )
 else ()
   set ( LJVM_MODE elfasm )
@@ -212,6 +211,39 @@
     SET(DASM_FLAGS ${DASM_FLAGS} -D GPR64)
   ENDIF()
 ENDIF()
+
+IF(APPLE)
+  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLUAJIT_UNWIND_EXTERNAL")
+ELSEIF(NOT WIN32)
+  IF(NOT LJ_NO_UNWIND_1)
+    # Find out whether the target toolchain always generates unwind tables.
+    MESSAGE(STATUS "Checking if the toolchain always generates unwind tables")
+    SET(TOOLCHAIN_GENERATES_UNWIND_TABLES 0)
+    SET(TMPUNWIND_DIR "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp")
+    file(WRITE "${TMPUNWIND_DIR}/tmpunwind.c" "extern void b(void);int a(void){b();return 0;}")
+    # This seems flimsy; it would be better to use something like CMake's try_compile but
+    # there doesn't seem to be a way to avoid linking when using try_compile so this particular
+    # code can't use it (at least without modifying the test code)
+    execute_process(COMMAND "${CMAKE_C_COMPILER}" -c -x c "${TMPUNWIND_DIR}/tmpunwind.c" -o "${TMPUNWIND_DIR}/tmpunwind.o"
+      RESULT_VARIABLE UNWIND_TEST_ERRORED)
+    IF(NOT UNWIND_TEST_ERRORED)
+      file(READ "${TMPUNWIND_DIR}/tmpunwind.o" TMPUNWIND_O)
+      string(FIND "${TMPUNWIND_O}" "eh_frame" EH_FRAME_FOUND)
+      string(FIND "${TMPUNWIND_O}" "__unwind_info" UNWIND_INFO_FOUND)
+      IF(EH_FRAME_FOUND OR UNWIND_INFO_FOUND)
+        SET(TOOLCHAIN_GENERATES_UNWIND_TABLES 1)
+      ENDIF()
+    ENDIF()
+
+    IF(TOOLCHAIN_GENERATES_UNWIND_TABLES)
+      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DLUAJIT_UNWIND_EXTERNAL")
+      MESSAGE(STATUS "Toolchain does generate unwind tables")
+    ELSE()
+      MESSAGE(STATUS "Toolchain does not generate unwind tables")
+    ENDIF()
+  ENDIF()
+ENDIF()
+

 add_executable(minilua ${LUAJIT_DIR}/src/host/minilua.c)
 SET_TARGET_PROPERTIES(minilua PROPERTIES COMPILE_DEFINITIONS "${TARGET_ARCH}")


[Build] Suppress pointer truncation error

Added `-fpermissive` flag to GCC compilation options to suppress a lot of
error messages related to pointer precision loss. The MSVC already does this.

--- SPEC_PSXPC_N/PLATFORM/Linux.cmake
+++ SPEC_PSXPC_N/PLATFORM/Linux.cmake
@@ -16,11 +16,11 @@

 set(PSX_LIB Emulator_${TARGET_ARCH})

-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-narrowing -std=c++11")
-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wno-narrowing -std=c++11")
-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wno-narrowing -std=c++11")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing -std=c++11")
-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-narrowing -std=c++11")
-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wno-narrowing -std=c++11")
+set(CMAKE_C_FLAGS           "${CMAKE_C_FLAGS} -fpermissive -Wno-narrowing -std=c++11")
+set(CMAKE_C_FLAGS_DEBUG     "${CMAKE_C_FLAGS_DEBUG} -fpermissive -Wno-narrowing -std=c++11")
+set(CMAKE_C_FLAGS_RELEASE   "${CMAKE_C_FLAGS_RELEASE} -fpermissive -Wno-narrowing -std=c++11")
+set(CMAKE_CXX_FLAGS         "${CMAKE_CXX_FLAGS} -fpermissive -Wno-narrowing -std=c++11")
+set(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX_FLAGS_DEBUG} -fpermissive -Wno-narrowing -std=c++11")
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fpermissive -Wno-narrowing -std=c++11")

 endif()


Remove project-specific language in the generic add_sources cmake rules

--- etc/cmake/add_sources.cmake
+++ etc/cmake/add_sources.cmake
@@ -6,13 +6,13 @@

         set_property(
             GLOBAL APPEND PROPERTY
-            "EMULATOR_SRCS"
+            "ALL_SRC_FILES"
             "${source}"
         )
     endforeach()
 endfunction()

 function(declare_executable binary_name)
-    get_property(sources GLOBAL PROPERTY EMULATOR_SRCS)
+    get_property(sources GLOBAL PROPERTY ALL_SRC_FILES)
     add_executable("${binary_name}" "${sources}")
 endfunction()


detect mingw's libdxerr9.a

detect mingw's libdxerr9.a

--HG--
branch : mingw-dx

--- CMake/Packages/FindDirectX.cmake
+++ CMake/Packages/FindDirectX.cmake
@@ -56,7 +56,7 @@
   endif(CMAKE_CL_64)
   find_library(DirectX9_LIBRARY NAMES d3d9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
   find_library(DirectX9_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
-  find_library(DirectX9_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
+  find_library(DirectX9_DXERR_LIBRARY NAMES DxErr dxerr9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})
   find_library(DirectX9_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX})

   findpkg_finish(DirectX9)


Windows pack settings

Windows pack settings

--- CMakeModules/CPackSettings.cmake
+++ CMakeModules/CPackSettings.cmake
@@ -4,13 +4,23 @@
 SET(CPACK_PACKAGE_VERSION_MAJOR "${KRISLIBRARY_MAJOR_VERSION}")
 SET(CPACK_PACKAGE_VERSION_MINOR "${KRISLIBRARY_MINOR_VERSION}")
 SET(CPACK_PACKAGE_VERSION_PATCH "${KRISLIBRARY_PATCH_VERSION}")
-SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${V_MAJOR}.${V_MINOR}")
+#SET(CPACK_PACKAGE_INSTALL_DIRECTORY "KrisLibrary ${V_MAJOR}.${V_MINOR}")
+SET(CPACK_PACKAGE_INSTALL_DIRECTORY "KrisLibrary")
 SET(CPACK_PACKAGE_CONTACT "K. Hauser")
 SET(CPACK_PACKAGE_VENDOR "Indiana University")
-SET(CPACK_GENERATOR "DEB")
-SET(CPACK_SOURCE_GENERATOR "TGZ")
-SET(CPACK_SOURCE_PACKAGE_FILE_NAME
+SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")
+IF(WIN32)
+  SET(CPACK_GENERATOR "WIX")
+  SET(CPACK_WIX_UPGRADE_GUID 80F4492E-C8E2-4785-BF7F-E0AD711AE4E6)
+  SET(CPACK_SOURCE_GENERATOR "ZIP")
+  SET(CPACK_SOURCE_PACKAGE_FILE_NAME
   "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+ELSE(WIN32)
+  SET(CPACK_GENERATOR "DEB")
+  SET(CPACK_SOURCE_GENERATOR "TGZ")
+  SET(CPACK_SOURCE_PACKAGE_FILE_NAME
+  "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
+ENDIF(WIN32)

  # This must always be last statement!
 INCLUDE(CPack)


Force linking of ws2_32 when linking kNet on Windows.

--- cmake/ConfigurePackages.cmake
+++ cmake/ConfigurePackages.cmake
@@ -217,6 +217,9 @@
 macro(link_package_knet)
     target_link_libraries(${TARGET_NAME} optimized kNet)
     target_link_libraries(${TARGET_NAME} debug kNet)
+    if (WIN32)
+        target_link_libraries(${TARGET_NAME} ws2_32.lib)
+    endif ()
 endmacro()

 macro(use_package_bullet)


Fix typo in FindIcuUC.cmake

Fix typo in FindIcuUC.cmake

--- cmake/Modules/FindIcuUC.cmake
+++ cmake/Modules/FindIcuUC.cmake
@@ -15,7 +15,7 @@
 find_library(ICU_UC_LIBRARY icuuc
         HINTS ${PC_ICU_UC_LIBDIR} ${PC_ICU_UC_LIBRARY_DIRS})

-find_library(ICU_DATA_LIBRARY ucudata
+find_library(ICU_DATA_LIBRARY icudata
         HINTS ${PC_ICU_UC_LIBDIR} ${PC_ICU_UC_LIBRARY_DIRS})

 set(ICU_UC_INCLUDE_DIRS ${ICU_UC_INCLUDE_DIR})


Simplify scidb path discovery, and rely on SCIDB_ROOT_DIR

--- cmake/Modules/FindScidb.cmake
+++ cmake/Modules/FindScidb.cmake
@@ -1,6 +1,6 @@
 # -- Check for the SciDB source tree --
 #
-# Uses path overrides: SCIDBINC_PATH SCIDB_DIR
+# Required: SciDB source checkout. Specify using SCIDB_ROOT_DIR
 #
 # Defines:
 #
@@ -28,19 +28,21 @@

 # Look for includes and libraries
 find_path(SCIDB_INCLUDE_ARRAY  array/Array.h
-  PATHS $ENV{SCIDBINC_PATH}
-  $ENV{SCIDBTOP_PATH}/src
-  ${SCIDB_DIR}/include
-  ${SCIDB_DIR}/src
-  DOC "Path to include directory for array/Array.h")
-find_path(SCIDB_INCLUDE_CFG  network/SciDBConfig.h PATHS $ENV{SCIDBINC_PATH} $ENV{SCIDBTOP_PATH}/src ${SCIDB_DIR}/include ${SCIDB_DIR}/src )
-find_path(SCIDB_SRC_DIR array/Metadata.cpp PATH $ENV{SCIDBTOP_PATH}/src ${SCIDB_DIR}/src)
+  HINTS ${SCIDB_ROOT_DIR}
+  PATH_SUFFIXES include src
+  DOC "Path to include directory for array/Array.h in Scidb source tree")

-find_package_handle_standard_args(SCIDB DEFAULT_MSG SCIDB_INCLUDE_ARRAY SCIDB_INCLUDE_CFG SCIDB_SRC_DIR)
+find_path(SCIDB_SRC_DIR array/Metadata.cpp
+  HINTS $SCIDB_ROOT_DIR
+  PATH_SUFFIXES src)
+
+find_package_handle_standard_args(SCIDB DEFAULT_MSG
+  SCIDB_INCLUDE_ARRAY
+  SCIDB_SRC_DIR)

 if(SCIDB_FOUND)
-  set(SCIDB_INCLUDES ${SCIDB_INCLUDE_ARRAY} ${SCIDB_INCLUDE_CFG})
-  set(SCIDB_CXX_FLAGS "-DPROJECT_ROOT=\\\"${SCIDB_DIR}/\\\"")
+  set(SCIDB_INCLUDES ${SCIDB_INCLUDE_ARRAY})
+  set(SCIDB_CXX_FLAGS "-DPROJECT_ROOT=\\\"${SCIDB_ROOT_DIR}/\\\"")

 endif(SCIDB_FOUND)
 mark_as_advanced(Scidb_FOUND SCIDB_INCLUDES SCIDB_SRC_DIR SCIDB_CXX_FLAGS)


QUIET no longer exists

QUIET no longer exists

svn path=/trunk/kdesupport/polkit-qt-1/; revision=1118733

--- cmake/modules/FindGLIB2.cmake
+++ cmake/modules/FindGLIB2.cmake
@@ -19,7 +19,7 @@
 if (NOT WIN32)
    find_package(PkgConfig)
    if (PKG_CONFIG_FOUND)
-     pkg_check_modules(PC_LibGLIB2 QUIET glib-2.0)
+     pkg_check_modules(PC_LibGLIB2 glib-2.0)
    endif (PKG_CONFIG_FOUND)
 endif(NOT WIN32)


Abort configure phase if forward_list is not supported ny the compiler. Tell the user why.

--- cmake_modules/LPSCommon.cmake
+++ cmake_modules/LPSCommon.cmake
@@ -124,6 +124,9 @@
     check_include_file_cxx(forward_list HAVE_FORWARD_LIST)
     check_include_file_cxx(fstream HAVE_FSTREAM)
     check_include_file_cxx(forward_list HAVE_FORWARD_LIST)
+    if(NOT HAVE_FORWARD_LIST)
+        message(FATAL_ERROR "ERROR: ${CMAKE_CXX_COMPILER} does not appear to support forward_list. Configure phase aborted")
+    endif()
     check_include_file_cxx(functional HAVE_FUNCTIONAL)
     check_include_file_cxx(iomanip HAVE_IOMANIP)
     check_include_file_cxx(ios HAVE_IOS)


fbcode_builder: ThriftCppLibrary: the output depends on the thrift templates

Summary:
Update ThriftCppLibrary.cmake to record that the output depends on the thrift
`cpp2` template files.  The `THRIFT_TEMPLATE_FILES` variable was defined in
D16062657 but doesn't appear to be used anywhere.  This uses it, and also
updates it to only match the C++ template files.

Reviewed By: wez

Differential Revision: D16738442

fbshipit-source-id: aa4097e9ec1d009ef1e3ee2efd03ffa19a82ed12

--- build/fbcode_builder/CMake/ThriftCppLibrary.cmake
+++ build/fbcode_builder/CMake/ThriftCppLibrary.cmake
@@ -77,7 +77,7 @@

   file(
     GLOB_RECURSE THRIFT_TEMPLATE_FILES
-    FOLLOW_SYMLINKS "${FBTHRIFT_TEMPLATES_DIR}/*.mustache"
+    FOLLOW_SYMLINKS "${FBTHRIFT_TEMPLATES_DIR}/cpp2/*.mustache"
   )

   # Emit the rule to run the thrift compiler
@@ -101,6 +101,7 @@
       "${THRIFT_FILE}"
     DEPENDS
       ${ARG_DEPENDS}
+      ${THRIFT_TEMPLATE_FILES}
   )

   # Now emit the library rule to compile the sources


use -ffp-contract=fast if the compiler recognizes it to generate FMAs

--- cmake/VcMacros.cmake
+++ cmake/VcMacros.cmake
@@ -344,6 +344,10 @@
       vc_add_compiler_flag(Vc_DEFINITIONS "-Wno-unnamed-type-template-args")
    endif()

+   if(NOT Vc_COMPILER_IS_MSVC)
+      vc_add_compiler_flag(Vc_DEFINITIONS "-ffp-contract=fast")
+   endif()
+
    OptimizeForArchitecture()
    set(Vc_DEFINITIONS "${Vc_ARCHITECTURE_FLAGS} ${Vc_DEFINITIONS}")


Add some doxygen commands for clang warnings

--- cmake/Warnings.cmake
+++ cmake/Warnings.cmake
@@ -46,7 +46,7 @@
 		#list(APPEND WarningFlags "/wd4365") #signed/unsigned mismatch
 		#list(APPEND WarningFlags "/wd4668") # is not defined as a preprocessor macro, replacing with '0' for
 	  elseif(WCLANG)
-		list(APPEND WarningFlags -Wno-unknown-warning-option -Wno-padded -Wno-undef -Wno-reserved-id-macro)
+		list(APPEND WarningFlags -Wno-unknown-warning-option -Wno-padded -Wno-undef -Wno-reserved-id-macro -fcomment-block-commands=test,retval)
 		if(NOT CMAKE_CXX_STANDARD EQUAL 98)
 			list(APPEND WarningFlags -Wno-c++98-compat -Wno-c++98-compat-pedantic)
 		endif()


fptu: fix linker gcov's flags for module (minor).

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -296,11 +296,9 @@
     endif()

     add_compile_flags("C;CXX" "-fprofile-arcs" "-ftest-coverage")
-    set(EXE_LINKER_FLAGS "${EXE_LINKER_FLAGS} -fprofile-arcs")
-    set(EXE_LINKER_FLAGS "${EXE_LINKER_FLAGS} -ftest-coverage")
-    set(SHARED_LINKER_FLAGS "${SHARED_LINKER_FLAGS} -fprofile-arcs")
-    set(SHARED_LINKER_FLAGS "${SHARED_LINKER_FLAGS} -ftest-coverage")
-
+    set(EXE_LINKER_FLAGS "${EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+    set(SHARED_LINKER_FLAGS "${SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
+    set(MODULE_LINKER_FLAGS "${MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
     # add_library(gcov SHARED IMPORTED)
   endif()


erthink: set ENABLE_BACKTRACE=OFF by default.

--- cmake/compiler.cmake
+++ cmake/compiler.cmake
@@ -191,7 +191,6 @@
   check_compiler_flag("-fexceptions" CC_HAS_FEXCEPTIONS)
   check_compiler_flag("-funwind-tables" CC_HAS_FUNWIND_TABLES)
   check_compiler_flag("-fno-omit-frame-pointer" CC_HAS_FNO_OMIT_FRAME_POINTER)
-  check_compiler_flag("-fno-stack-protector" CC_HAS_FNO_STACK_PROTECTOR)
   check_compiler_flag("-fno-common" CC_HAS_FNO_COMMON)
   check_compiler_flag("-Wno-strict-aliasing" CC_HAS_WNO_STRICT_ALIASING)
   check_compiler_flag("-ggdb" CC_HAS_GGDB)
@@ -357,7 +356,7 @@
   fiber' administrative command. Only works on x86 architectures, if compiled
   with gcc. If GNU binutils and binutils-dev libraries are installed, backtrace
   is output with resolved function (symbol) names. Otherwise only frame
-  addresses are printed." ${CMAKE_COMPILER_IS_GNUC${CMAKE_PRIMARY_LANG}})
+  addresses are printed." OFF)

 set(HAVE_BFD False)
 if(ENABLE_BACKTRACE)
@@ -459,9 +458,6 @@
   if(ENABLE_BACKTRACE)
     if(CC_HAS_FNO_OMIT_FRAME_POINTER)
       add_compile_flags("C;CXX" "-fno-omit-frame-pointer")
-    endif()
-    if(CC_HAS_FNO_STACK_PROTECTOR)
-      add_compile_flags("C;CXX" "-fno-stack-protector")
     endif()
   endif()


Updated configuration to support Intel's oneAPI compiler icx/icpx

--- cmake/gsConfig.cmake
+++ cmake/gsConfig.cmake
@@ -204,8 +204,8 @@
    # Apple explicitly disabled OpenMP support in their compilers that
    # are shipped with XCode but there is an easy workaround as
    # described at https://mac.r-project.org/openmp/
-   if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_C_COMPILER_ID STREQUAL "Clang" AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR
-       CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+   if ("x${CMAKE_C_COMPILER_ID}" STREQUAL "xAppleClang" OR "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" OR
+       "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xAppleClang" OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang" AND ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
       find_path(OpenMP_C_INCLUDE_DIR
         NAMES "omp.h" PATHS /usr/local /opt /opt/local /opt/homebrew PATH_SUFFICES include)
       find_path(OpenMP_CXX_INCLUDE_DIR
@@ -228,7 +228,7 @@
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas")
 endif()

-if (CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND NOT GISMO_WITH_OPENMP)
+if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xIntel" AND NOT GISMO_WITH_OPENMP)
    if ( CMAKE_SYSTEM_NAME MATCHES "Linux" )
      set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -diag-disable 3180") #comma for more warns
    elseif ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
@@ -248,7 +248,7 @@
 #string(TOUPPER ${CMAKE_BUILD_TYPE} TEMP)
 #message(STATUS "Using compilation flags: ${CMAKE_CXX_FLAGS}, ${CMAKE_CXX_FLAGS_${TEMP}}")

-if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+if("x${CMAKE_BUILD_TYPE}" STREQUAL "xRelease")
   #https://github.com/VcDevel/Vc/blob/master/cmake/OptimizeForArchitecture.cmake
   include( OptimizeForArchitecture )
   OptimizeForArchitecture()
@@ -256,4 +256,4 @@
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
   endforeach()
-endif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
+endif("x${CMAKE_BUILD_TYPE}" STREQUAL "xRelease")


fix RAM size for F3 series

fix RAM size for F3 series


Fixed yaml-cpp.pc file (with prefix)

Fixed yaml-cpp.pc file (with prefix)

--- yaml-cpp.pc.cmake
+++ yaml-cpp.pc.cmake
@@ -1,7 +1,7 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=@CMAKE_INSTALL_PREFIX@
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@
+libdir=${prefix}/@LIB_INSTALL_DIR@
+includedir=${prefix}/@INCLUDE_INSTALL_DIR@

 Name: Yaml-cpp
 Description: A YAML parser and emitter for C++


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 04)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   05)
+SET(KWSYS_DATE_STAMP_DAY   06)


KWSys Nightly Date Stamp

KWSys Nightly Date Stamp

--- Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
+++ Modules/ThirdParty/KWSys/src/KWSys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@
 SET(KWSYS_DATE_STAMP_MONTH 01)

 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   15)
+SET(KWSYS_DATE_STAMP_DAY   16)


Removing some debugging statements

Removing some debugging statements

--- Resources/ConfigureChecks.cmake
+++ Resources/ConfigureChecks.cmake
@@ -11,9 +11,9 @@
 # SET(SIZEOF_SIZE_T 0)
 # SET(SIZEOF_SSIZE_T 0)
 CHECK_TYPE_SIZE(size_t         SIZEOF_SIZE_T)
- MESSAGE (STATUS "SIZEOF_SIZE_T: ${SIZEOF_SIZE_T}")
+# MESSAGE (STATUS "SIZEOF_SIZE_T: ${SIZEOF_SIZE_T}")
 CHECK_TYPE_SIZE(ssize_t        SIZEOF_SSIZE_T)
 IF (NOT SIZEOF_SSIZE_T )
   SET (SIZEOF_SSIZE_T 4)
 ENDIF(NOT SIZEOF_SSIZE_T)
- MESSAGE (STATUS "SIZEOF_SSIZE_T: ${SIZEOF_SSIZE_T}")
+# MESSAGE (STATUS "SIZEOF_SSIZE_T: ${SIZEOF_SSIZE_T}")


ENH:  Update ITK tag

ENH:  Update ITK tag

--- SuperBuild/External_ITKv4.cmake
+++ SuperBuild/External_ITKv4.cmake
@@ -164,7 +164,7 @@
   set(${proj}_GIT_TAG f60bbd3aadc4b9fbf2cff1cf7227cef1e92b979a) ##
   set(ITK_VERSION_ID ITK-4.10) ### NOTE: When updating GIT_TAG, also update ITK_VERSION_ID

-  set(${proj}_GIT_TAG 9405479927dc36c95ff7b658cfb25580705be5ba) ##
+  set(${proj}_GIT_TAG 2714cc1805f50504f5b9a60d0f62ffec8e73989) ##
   set(ITK_VERSION_ID ITK-4.11) ### NOTE: When updating GIT_TAG, also update ITK_VERSION_ID

   ExternalProject_Add(${proj}


WIP: only get glue if vtk on

WIP: only get glue if vtk on

--- SuperBuild/External_ITKv4.cmake
+++ SuperBuild/External_ITKv4.cmake
@@ -117,8 +117,9 @@
       -DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel
       -DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK:  QUICK CHANGE
       -DModule_MGHIO:BOOL=ON
-      -DModule_ITKVtkGlue:BOOL=ON
-
+      if(USE_VTK)
+        -DModule_ITKVtkGlue:BOOL=ON
+      endif()
       ${${proj}_DCMTK_ARGS}
       ${${proj}_WRAP_ARGS}
       ${${proj}_FFTWF_ARGS}


FindCapnpProto.cmake change to isolate kj and capnp async lib discovery

--- src/cmake/FindCapnProto.cmake
+++ src/cmake/FindCapnProto.cmake
@@ -138,15 +138,10 @@
 find_library(CAPNP_LIB_KJ kj
   HINTS "${PKGCONFIG_CAPNP_LIBDIR}" ${PKGCONFIG_CAPNP_LIBRARY_DIRS}
 )
-find_library(CAPNP_LIB_KJ-ASYNC kj-async
-  HINTS "${PKGCONFIG_CAPNP_RPC_LIBDIR}" ${PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS}
-)
 find_library(CAPNP_LIB_CAPNP capnp
   HINTS "${PKGCONFIG_CAPNP_LIBDIR}" ${PKGCONFIG_CAPNP_LIBRARY_DIRS}
 )
-find_library(CAPNP_LIB_CAPNP-RPC capnp-rpc
-  HINTS "${PKGCONFIG_CAPNP_RPC_LIBDIR}" ${PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS}
-)
+
 mark_as_advanced(CAPNP_LIB_KJ CAPNP_LIB_KJ-ASYNC CAPNP_LIB_CAPNP CAPNP_LIB_CAPNP-RPC)
 set(CAPNP_LIBRARIES_LITE
   ${CAPNP_LIB_KJ}
@@ -162,6 +157,12 @@
 if(CAPNP_LIB_CAPNP AND NOT CAPNP_LIB_CAPNP-RPC)
   set(CAPNP_DEFINITIONS -DCAPNP_LITE)
 else()
+  find_library(CAPNP_LIB_KJ-ASYNC kj-async
+    HINTS "${PKGCONFIG_CAPNP_RPC_LIBDIR}" ${PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS}
+  )
+  find_library(CAPNP_LIB_CAPNP-RPC capnp-rpc
+    HINTS "${PKGCONFIG_CAPNP_RPC_LIBDIR}" ${PKGCONFIG_CAPNP_RPC_LIBRARY_DIRS}
+  )
   set(CAPNP_DEFINITIONS)
 endif()


Improve FindDCMTK.cmake documentation

Improve FindDCMTK.cmake documentation

Also added a troubleshooting section addressing issue #382

--- Utilities/CMake/FindDCMTK.cmake
+++ Utilities/CMake/FindDCMTK.cmake
@@ -1,9 +1,7 @@
-# adapted version of FindDCMTK, better suited for super-builds
-
 # - find DCMTK libraries and applications
-#
-
-#  DCMTK_INCLUDE_DIRS   - Directories to include to use DCMTK
+# The module defines the following variables:
+#
+#  DCMTK_INCLUDE_DIRS  - Directories to include to use DCMTK
 #  DCMTK_LIBRARIES     - Files to link against to use DCMTK
 #  DCMTK_FOUND         - If false, don't try to use DCMTK
 #  DCMTK_DIR           - (optional) Source directory for DCMTK
@@ -12,7 +10,90 @@
 # directories and compiled libraries if you've just compiled it in the
 # source tree. Just set it to the root of the tree where you extracted
 # the source (default to /usr/include/dcmtk/)
-
+#
+#
+# This file is able to find version of DCMTK that do or do not export
+# a DCMTKConfig.cmake file.
+#
+# IMPORTANT: A set of patches has been contributed to DCMTK
+# maintainers, as soon as:
+#   (1) it has been integrated upstream so that it is available in
+#   an official release (for example X.Y.Z),
+#   (2) code bases have been updated to build against X.Y.Z
+# This file could be removed.
+#
+# The set of patches is listed here: https://github.com/commontk/DCMTK/compare/79030ba...f461865
+#
+#
+# Waiting for this to happen, build systems will have to be able
+# to support different versions of DCMTK.
+#
+# On any given system, the following combination of DCMTK version could be
+# considered:
+#
+#         |   SYSTEM DCMTK      +      LOCAL DCMTK      |     Supported ?   |
+# ---------------------------------------------------------------------------
+# Case A  |   NA                +      [ ] DCMTKConfig  |         YES       |
+# ------------------------------------------------------|--------------------
+# Case B  |   NA                +      [X] DCMTKConfig  |         YES       |
+# ------------------------------------------------------|--------------------
+# Case C  |   [ ] DCMTKConfig   +      NA               |         YES       |
+# ------------------------------------------------------|--------------------
+# Case D  |   [X] DCMTKConfig   +      NA               |         YES       |
+# ------------------------------------------------------|--------------------
+# Case E  |   [ ] DCMTKConfig   +      [ ] DCMTKConfig  |         YES (*)   |
+# ------------------------------------------------------|--------------------
+# Case F  |   [X] DCMTKConfig   +      [ ] DCMTKConfig  |         NO        |
+# ------------------------------------------------------|--------------------
+# Case G  |   [ ] DCMTKConfig   +      [X] DCMTKConfig  |         YES       |
+# ------------------------------------------------------|--------------------
+# Case H  |   [X] DCMTKConfig   +      [X] DCMTKConfig  |         YES       |
+# ---------------------------------------------------------------------------
+#
+#  (*) See Troubleshooting section.
+#
+# Legend:
+#
+#   NA ...............: Means that no System or Local DCMTK is available
+#
+#   [ ] DCMTKConfig ..: Means that the version of DCMTK does NOT export a DCMTKConfig.cmake file.
+#
+#   [X] DCMTKConfig ..: Means that the version of DCMTK exports a DCMTKConfig.cmake file.
+#
+#
+#
+# In CTK commits 52d953 and 74b4b07, the FindDCMTK.cmake module has been updated to be able
+# to find both version of DCMTK ([ ] DCMTKConfig and [X] DCMTKConfig).
+#
+# It is a two steps process:
+#
+#   * Step 1:  Attempt to find DCMTK version providing a DCMTKConfig.cmake file. This is done
+#              with the help of ''
+#
+#   * Step 2:  If step 1 failed, rely on FindDCMTK.cmake to set DCMTK_* variables details below.
+#
+#
+#
+# Troubleshooting:
+#
+#    What to do if my project find a different version of DCMTK ?
+#
+#    Remove DCMTK entry from the CMake registry.
+#    Search for "CMake user package registry" on http://www.cmake.org/cmake/help/v2.8.9/cmake.html#command:find_package
+#
+#    Details: As some point, the DCMTK build tree was exported [1][2][3]. Indeed, before the set of
+#    patches discussed above has been contributed to upstream DCMTK, an initial implementation of
+#    a DCMTK build system exporting its build tree has been implemented and has been tested by some
+#    folks. This had the effect of populating the CMake registry.
+#
+#    Since Step1 does not exclude the CMake registry, when dealing with case E, the incorrect version of
+#    DCMTK could be found.
+#
+#    [1] http://slicer-devel.65872.n3.nabble.com/Packaging-seems-to-work-again-tp4028121p4028134.html
+#    [2] https://www.assembla.com/spaces/slicerrt/tickets/244-dcmtk_dir-vs--dcmtkconfig-cmake?comment=267984263#comment:267984263
+#    [3] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:export
+#
+#
 #=============================================================================
 # Copyright 2004-2009 Kitware, Inc.
 # Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
@@ -37,7 +118,8 @@
 set(_SAVED_DCMTK_DIR ${DCMTK_DIR})

 #
-# First, try to use NO_MODULE
+# Step1: Attempt to find a version of DCMTK providing a DCMTKConfig.cmake file.
+#
 message(STATUS "Trying to find DCMTK expecting DCMTKConfig.cmake")
 find_package(DCMTK QUIET NO_MODULE)
 if(DCMTK_FOUND
@@ -53,6 +135,11 @@

 # Restore the value reset by the previous call to 'find_package(DCMTK QUIET NO_MODULE)'
 set(DCMTK_DIR ${_SAVED_DCMTK_DIR} CACHE PATH "The directory containing a CMake configuration file for DCMTK." FORCE)
+
+
+#
+# Step2: Attempt to find a version of DCMTK that does NOT provide a DCMTKConfig.cmake file.
+#

 # prefer DCMTK_DIR over default system paths like /usr/lib
 if(DCMTK_DIR)


ZeroMQ version has been updated (Windows build works with several compilers and build tools)

--- cmake/projects/ZeroMQ/hunter.cmake
+++ cmake/projects/ZeroMQ/hunter.cmake
@@ -15,9 +15,9 @@
   VERSION
   "4.1.4"
   URL
-  "https://github.com/hunter-packages/zeromq4-1/archive/v4.1.4-hunter-p1.tar.gz"
+  "https://github.com/hunter-packages/zeromq4-1/archive/v4.1.4-hunter-p2.tar.gz"
   SHA1
-  be57db45f4f998c04d1804132b1302f923405fa4
+  a3f39b9bbc23cf896cb78b3b33e3b46a45177eb5
   )

 hunter_pick_scheme(DEFAULT url_sha1_cmake)


refs #6566 Compiling/configuring no longer changes XZ source files (it changes a copy)
This prevents unnecessarily modified files in svn/git

git-svn-id: b5c078ec0b4d3a50497e9dd3081db18a5b4f16e5@55400 c7de825b-a66e-492c-adef-691d508d4ae1

--- cmake_modules/TokuThirdParty.cmake
+++ cmake_modules/TokuThirdParty.cmake
@@ -51,13 +51,15 @@
   message(FATAL_ERROR "Can't find the xz sources.  Please check them out to ${XZ_SOURCE_DIR} or modify TOKU_SVNROOT (${TOKU_SVNROOT}) or XZ_SOURCE_DIR.")
 endif ()

+FILE(GLOB XZ_ALL_FILES ${XZ_SOURCE_DIR}/*)
 if (CMAKE_GENERATOR STREQUAL Ninja)
   ## ninja doesn't understand "$(MAKE)"
   ExternalProject_Add(build_lzma
     PREFIX xz
-    SOURCE_DIR "${XZ_SOURCE_DIR}"
+    DOWNLOAD_COMMAND
+        cd ${XZ_SOURCE_DIR} && cp -ru "${XZ_ALL_FILES}" "<SOURCE_DIR>/"
     CONFIGURE_COMMAND
-        "${XZ_SOURCE_DIR}/configure" ${xz_configure_opts}
+        "<SOURCE_DIR>/configure" ${xz_configure_opts}
         "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/xz"
     BUILD_COMMAND
         make -C src/liblzma
@@ -69,9 +71,10 @@
   ## seem to break Xcode...
   ExternalProject_Add(build_lzma
     PREFIX xz
-    SOURCE_DIR "${XZ_SOURCE_DIR}"
+    DOWNLOAD_COMMAND
+        cd ${XZ_SOURCE_DIR} && cp -ru "${XZ_ALL_FILES}" "<SOURCE_DIR>/"
     CONFIGURE_COMMAND
-        "${XZ_SOURCE_DIR}/configure" ${xz_configure_opts}
+        "<SOURCE_DIR>/configure" ${xz_configure_opts}
         "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/xz"
     BUILD_COMMAND
         $(MAKE) -C src/liblzma
@@ -79,6 +82,12 @@
         $(MAKE) -C src/liblzma install
     )
 endif ()
+FILE(GLOB_RECURSE XZ_ALL_FILES_RECURSIVE ${XZ_SOURCE_DIR}/*)
+ExternalProject_Add_Step(build_lzma reclone_src # Names of project and custom step
+    COMMENT "(re)cloning xz source..."     # Text printed when step executes
+    DEPENDERS download configure   # Steps that depend on this step
+    DEPENDS   ${XZ_ALL_FILES_RECURSIVE}   # Files on which this step depends
+)

 set_source_files_properties(
   "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/xz/include/lzma.h"


Comment typo fix.

Comment typo fix.

--- cmake/Sagase.cmake
+++ cmake/Sagase.cmake
@@ -77,7 +77,7 @@
 # results are in ${PREFIX}_INCLUDE_DIRS, ${PREFIX}_LIBRARY_DIRS,
 # ${PREFIX}_LIBRARIES, ${PREFIX}_DEFINITIONS, or fatal error.

-# Tryies the following methods to find a package, in order of decreasing
+# Tries the following methods to find a package, in order of decreasing
 # specialization or detail:
 # 1. find_package
 # 2. OS-dependent (pkg-config, framework, etc.)


Slight improvement to our ADD_PLUGIN() CMake macro [ci skip].

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -474,6 +474,8 @@
     # Qt modules

     FOREACH(QT_MODULE ${QT_MODULES})
+        FIND_PACKAGE(Qt5${QT_MODULE} REQUIRED)
+
         TARGET_LINK_LIBRARIES(${PROJECT_NAME}
             Qt5::${QT_MODULE}
         )


Some minor cleaning up.

Some minor cleaning up.

--- cmake/common.cmake
+++ cmake/common.cmake
@@ -55,7 +55,7 @@
             SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
         ENDIF()

-        # Make sure that debugging is on for Qt
+        # Make sure that debugging is on in Qt

         ADD_DEFINITIONS(-DQT_DEBUG)
     ELSE()
@@ -91,7 +91,7 @@
             #          so...
         ENDIF()

-        # Make sure that debugging is off for Qt
+        # Make sure that debugging is off in Qt

         ADD_DEFINITIONS(-DQT_NO_DEBUG)
     ENDIF()