ConfigurePackages.cmake: fix lib lookup for OpenAL, Ogg and Vorbis. Remove deprecated prebuilt deps stuff while at it.

--- cmake/ConfigurePackages.cmake
+++ cmake/ConfigurePackages.cmake
@@ -166,11 +166,16 @@
     endif()
 endmacro (configure_qtpropertybrowser)

-macro (configure_openal)
+macro(configure_openal)
+    if (CMAKE_CL_64)
+        SET(WIN_PLATFORM Win64)
+    else()
+        set(WIN_PLATFORM Win32)
+    endif()
     sagase_configure_package(OPENAL
         NAMES OpenAL openal
         COMPONENTS al OpenAL32
-        PREFIXES ${ENV_TUNDRA_DEP_PATH}/OpenAL ${ENV_TUNDRA_DEP_PATH}/OpenAL/libs/Win32)
+        PREFIXES ${ENV_TUNDRA_DEP_PATH}/OpenAL ${ENV_TUNDRA_DEP_PATH}/OpenAL/libs/${WIN_PLATFORM})

         if (OPENAL_FOUND)
             set (OPENAL_LIBRARIES ${OPENAL_LIBRARY})
@@ -236,7 +241,6 @@
     message (STATUS "Using BULLET_DIR = ${BULLET_DIR}")

     if (WIN32 OR ANDROID)
-        include_directories(${BULLET_DIR}/include) # For prebuilt VS2008/VS2010 deps.
         include_directories(${BULLET_DIR}/src) # For full-built source deps.
         if (NOT ANDROID)
             link_directories(${BULLET_DIR}/lib)
@@ -252,138 +256,71 @@
 macro(link_package_bullet)
     # TODO just checking for RelWithDebInfo dir doesn't necessary cut it as user could have modified
     # the build script and built Release instead during initial deps build. This is however very unlikely.
-    if (WIN32 AND IS_DIRECTORY ${BULLET_DIR}/lib/RelWithDebInfo) # Full-build deps
+    if (WIN32) # Full-build deps
         link_directories(${TARGET_NAME}/lib/$(ConfigurationName))
         target_link_libraries(${TARGET_NAME} debug LinearMath.lib debug BulletDynamics.lib BulletCollision.lib)
         target_link_libraries(${TARGET_NAME} optimized LinearMath.lib optimized BulletDynamics.lib optimized BulletCollision.lib)
-    elseif (WIN32 AND IS_DIRECTORY ${BULLET_DIR}/lib/Release) # prebuilt deps package
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/lib/Debug/LinearMath.lib)
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/lib/Debug/BulletDynamics.lib)
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/lib/Debug/BulletCollision.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/lib/Release/LinearMath.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/lib/Release/BulletDynamics.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/lib/Release/BulletCollision.lib)
-    elseif (WIN32 AND IS_DIRECTORY ${BULLET_DIR}/msvc/2008) # TODO DEPRECATED Remove this path (for old full prebuilt deps in /msvc/2008/lib/)
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/msvc/2008/lib/debug/LinearMath.lib)
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/msvc/2008/lib/debug/BulletDynamics.lib)
-        target_link_libraries(${TARGET_NAME} debug ${BULLET_DIR}/msvc/2008/lib/debug/BulletCollision.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/msvc/2008/lib/release/LinearMath.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/msvc/2008/lib/release/BulletDynamics.lib)
-        target_link_libraries(${TARGET_NAME} optimized ${BULLET_DIR}/msvc/2008/lib/release/BulletCollision.lib)
     else()
         target_link_libraries(${TARGET_NAME} optimized BulletDynamics optimized BulletCollision optimized LinearMath)
-        if (WIN32)
-            target_link_libraries(${TARGET_NAME} debug BulletDynamics_d debug BulletCollision_d debug LinearMath_d)
-        endif()
     endif()
 endmacro()

 macro(use_package_ogg)
-    if (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/ogg/include/ogg)
-        # Using full-built or prebuilt deps made from fullbuild.
-        include_directories(${ENV_TUNDRA_DEP_PATH}/ogg/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/ogg/lib)
-    else ()
-        # For old prebuilt VS2008/VS2010 deps. TODO: safe to remove?
-        include_directories(${ENV_TUNDRA_DEP_PATH}/libogg/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/libogg/lib)
-    endif ()
+    # Using full-built deps
+    include_directories(${ENV_TUNDRA_DEP_PATH}/ogg/include)
+    link_directories(${ENV_TUNDRA_DEP_PATH}/ogg/lib)
 endmacro()

 macro(link_package_ogg)
     if (MSVC)
         # Always use ENV_TUNDRA_DEP_PATH as its read from cache. $ENV{TUNDRA_DEP_PATH} is not and can be empty/incorrect.
-        # TODO Ugly, implement the following using less lines of code
-        if (MSVC90 AND IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/ogg/win32/VS2008/Win32) # Using full-built deps VC9 deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/ogg/win32/VS2008/Win32/Release/libogg_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/ogg/win32/VS2008/Win32/Debug/libogg_static.lib)
-        elseif (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32) # Using full-built deps VC10/11 deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/ogg/win32/VS2010/Win32/Release/libogg_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/ogg/win32/VS2010/Win32/Debug/libogg_static.lib)
-        elseif (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/ogg/lib/Release)
-            # Using pre-built deps mirrored from full-built deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/ogg/lib/Release/libogg_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/ogg/lib/Debug/libogg_static.lib)
-        else()
-            # Using old pre-built VS2008/VS2010 deps. TODO: safe to remove?
-            target_link_libraries(${TARGET_NAME} optimized libogg)
-            target_link_libraries(${TARGET_NAME} debug liboggd)
-        endif()
+        if (MSVC90)
+            set(VS2008_OR_VS2010 "VS2008")
+        else()
+            set(VS2008_OR_VS2010 "VS2010")
+        endif()
+        target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/ogg/win32/${VS2008_OR_VS2010}/$(Platform)/Release/libogg_static.lib)
+        target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/ogg/win32/${VS2008_OR_VS2010}/$(Platform)/Debug/libogg_static.lib)
     else()
         target_link_libraries(${TARGET_NAME} general ogg)
     endif()
 endmacro()

 macro(use_package_vorbis)
-    if (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/vorbis/include/vorbis)
-        # Using full-built or prebuilt deps made from fullbuild.
-        include_directories(${ENV_TUNDRA_DEP_PATH}/vorbis/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/vorbis/lib)
-    else ()
-        # For old prebuilt VS2008/VS2010 deps. TODO: safe to remove?
-        include_directories(${ENV_TUNDRA_DEP_PATH}/libvorbis/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/libvorbis/lib)
-    endif ()
+    # Using full-built deps made from fullbuild.
+    include_directories(${ENV_TUNDRA_DEP_PATH}/vorbis/include)
+    link_directories(${ENV_TUNDRA_DEP_PATH}/vorbis/lib)
 endmacro()

 macro(link_package_vorbis)
     if (MSVC)
         # Always use ENV_TUNDRA_DEP_PATH as its read from cache. $ENV{TUNDRA_DEP_PATH} is not and can be empty/incorrect.
-        # TODO Ugly, implement the following using less lines of code
-        if (MSVC90 AND IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2008/Win32) # Using full-built deps VC9 deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2008/Win32/Release/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2008/Win32/Release/libvorbisfile_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2008/Win32/Debug/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2008/Win32/Debug/libvorbisfile_static.lib)
-        elseif (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32) # Using full-built deps VC10/11 deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32/Release/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32/Release/libvorbisfile_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32/Debug/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/VS2010/Win32/Debug/libvorbisfile_static.lib)
-        elseif (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/vorbis/lib/Release)
-            # Using pre-built deps mirrored from full-built deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/lib/Release/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/lib/Release/libvorbisfile_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/lib/Debug/libvorbis_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/lib/Debug/libvorbisfile_static.lib)
+        if (MSVC90)
+            set(VS2008_OR_VS2010 "VS2008")
         else()
-            # Using old pre-built VS2008/VS2010 deps. TODO: safe to remove?
-            target_link_libraries(${TARGET_NAME} optimized libvorbis optimized libvorbisfile)
-            target_link_libraries(${TARGET_NAME} debug libvorbisd debug libvorbisfiled)
-        endif()
+            set(VS2008_OR_VS2010 "VS2010")
+        endif()
+        target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/${VS2008_OR_VS2010}/$(Platform)/Release/libvorbis_static.lib)
+        target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/${VS2008_OR_VS2010}/$(Platform)/Release/libvorbisfile_static.lib)
+        target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/${VS2008_OR_VS2010}/$(Platform)/Debug/libvorbis_static.lib)
+        target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/vorbis/win32/${VS2008_OR_VS2010}/$(Platform)/Debug/libvorbisfile_static.lib)
     else()
         target_link_libraries(${TARGET_NAME} general vorbis general vorbisfile)
     endif()
 endmacro()

 macro(use_package_theora)
-    if (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/theora/include/theora)
-        # Using full-built or prebuilt deps made from fullbui
-        include_directories(${ENV_TUNDRA_DEP_PATH}/theora/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/theora/lib)
-    else ()
-        # For old prebuilt VS2008/VS2010 deps. TODO: safe to remove
-        include_directories(${ENV_TUNDRA_DEP_PATH}/libtheora/include)
-        link_directories(${ENV_TUNDRA_DEP_PATH}/libtheora/lib)
-    endif ()
+    # Using full-built deps made from fullbui
+    include_directories(${ENV_TUNDRA_DEP_PATH}/theora/include)
+    link_directories(${ENV_TUNDRA_DEP_PATH}/theora/lib)
 endmacro()

 macro(link_package_theora)
     if (MSVC)
         # Always use ENV_TUNDRA_DEP_PATH as its read from cache. $ENV{TUNDRA_DEP_PATH} is not and can be empty/incorrect.
-        if (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/theora/win32/VS2008/Win32)
-            # Using full-built deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/theora/win32/VS2008/Win32/Release_SSE2/libtheora_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/theora/win32/VS2008/Win32/Debug/libtheora_static.lib)
-        elseif (IS_DIRECTORY ${ENV_TUNDRA_DEP_PATH}/theora/lib/Release_SSE2)
-            # Using pre-built deps mirrored from full-built deps.
-            target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/theora/lib/Release_SSE2/libtheora_static.lib)
-            target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/theora/lib/Debug/libtheora_static.lib)
-        else()
-            # Using pre-built VS2008/VS2010 deps. TODO: safe to remove?
-            target_link_libraries(${TARGET_NAME} optimized libtheora)
-            target_link_libraries(${TARGET_NAME} debug libtheorad)
-        endif()
+        # Using full-built deps.
+        target_link_libraries(${TARGET_NAME} optimized ${ENV_TUNDRA_DEP_PATH}/theora/win32/VS2008/$(Platform)/Release_SSE2/libtheora_static.lib)
+        target_link_libraries(${TARGET_NAME} debug ${ENV_TUNDRA_DEP_PATH}/theora/win32/VS2008/$(Platform)/Debug/libtheora_static.lib)
     else()
         target_link_libraries(${TARGET_NAME} general theora)
     endif()
@@ -391,10 +328,7 @@

 macro(use_package_qtpropertybrowser)
     include_directories(${ENV_TUNDRA_DEP_PATH}/qt-solutions/qtpropertybrowser/src) # For full-built deps.
-    include_directories(${ENV_TUNDRA_DEP_PATH}/qtpropertybrowser/include) # For prebuilt deps mirrored from full-built deps.
-    include_directories(${ENV_TUNDRA_DEP_PATH}/QtPropertyBrowser/includes) # For prebuilt deps vs2008.
     link_directories(${ENV_TUNDRA_DEP_PATH}/qt-solutions/qtpropertybrowser/lib) # For full-built deps.
-    link_directories(${ENV_TUNDRA_DEP_PATH}/QtPropertyBrowser/lib) # For prebuilt deps vs2008.
 endmacro()

 macro(link_package_qtpropertybrowser)


Wyszukiwanie GMP jest teraz normalnie wykonywane (nie cicho).

--- cmake/Modules/FindGMPXX.cmake
+++ cmake/Modules/FindGMPXX.cmake
@@ -9,7 +9,7 @@

 # GMPXX needs GMP

-find_package( GMP QUIET )
+find_package( GMP )

 if(GMP_FOUND)


Run browser tests in serial to avoid memory problems

--- cmake/travis_continuous.cmake
+++ cmake/travis_continuous.cmake
@@ -18,7 +18,7 @@
   )
 elseif(test_group STREQUAL browser)
   ctest_test(
-    PARALLEL_LEVEL 4 RETURN_VALUE res
+    PARALLEL_LEVEL 1 RETURN_VALUE res
     EXCLUDE_LABEL girder_python
   )
   file(RENAME "${CTEST_BINARY_DIRECTORY}/js_coverage.xml" "${CTEST_BINARY_DIRECTORY}/coverage.xml")


Python executable filename could be different

--- ice40/family.cmake
+++ ice40/family.cmake
@@ -22,7 +22,7 @@
         set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.bin)
         set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
         add_custom_command(OUTPUT ${DEV_CC_DB}
-                COMMAND python3 ${DB_PY} -b -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}
+                COMMAND ${PYTHON_EXECUTABLE} ${DB_PY} -b -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}
                 DEPENDS ${DEV_TXT_DB} ${DB_PY}
                 )
         target_sources(ice40_chipdb PRIVATE ${DEV_CC_DB})
@@ -38,7 +38,7 @@
         set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.cc)
         set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
         add_custom_command(OUTPUT ${DEV_CC_DB}
-                COMMAND python3 ${DB_PY} -c -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}.new
+                COMMAND ${PYTHON_EXECUTABLE} ${DB_PY} -c -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}.new
                 COMMAND mv ${DEV_CC_DB}.new ${DEV_CC_DB}
                 DEPENDS ${DEV_TXT_DB} ${DB_PY}
                 )


build: temporary suppress format warnings since xtensa toolchain has long type for int32_t

--- tools/cmake/build.cmake
+++ tools/cmake/build.cmake
@@ -103,6 +103,10 @@
                                     "-Wextra"
                                     "-Wno-unused-parameter"
                                     "-Wno-sign-compare"
+                                    # ignore format for uint32_t/int32_t mostly, since xtensa have long types for them
+                                    # TODO: IDF-3735 for both xtensa and riscv32
+                                    "-Wno-error=format="
+                                    "-Wno-format"
                                     # ignore multiple enum conversion warnings since gcc 11
                                     # TODO: IDF-5163
                                     "-Wno-enum-conversion"


Ignoring unknown pragma warnings so hoomd builds cleanly on non openmp compilers.

git-svn-id: ea4449f358ea2d13621e3cf02b49d1c6a64ed7f9@2693 fa922fa7-2fde-0310-acd8-f43f465a7996

--- CMake/hoomd/HOOMDCFlagsSetup.cmake
+++ CMake/hoomd/HOOMDCFlagsSetup.cmake
@@ -27,10 +27,10 @@
         else (HONOR_GENTOO_FLAGS)

         # default flags for g++
-        set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
-        set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -Wall -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG -Wall" CACHE STRING "Flags used by the compiler during release builds." FORCE)
-        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -funroll-loops -DNDEBUG -Wall" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+        set(CMAKE_CXX_FLAGS_DEBUG "-g -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+        set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -Wall -Wno-unknown-pragmas -DNDEBUG" CACHE STRING "Flags used by the compiler during minimum size release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELEASE "-O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds." FORCE)
+        set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3 -funroll-loops -DNDEBUG -Wall -Wno-unknown-pragmas" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)

         endif (HONOR_GENTOO_FLAGS)
     elseif(MSVC80)


Removed the Found OpenThreads message

Removed the Found OpenThreads message

--- CMakeModules/FindOpenThreads.cmake
+++ CMakeModules/FindOpenThreads.cmake
@@ -77,8 +77,8 @@

 SET(OPENTHREADS_FOUND "NO")
 IF(OPENTHREADS_INCLUDE_DIR AND OPENTHREADS_LIBRARY)
-	SET(OPENTHREADS_FOUND "YES")
-  MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY})
+  SET(OPENTHREADS_FOUND "YES")
+  # MESSAGE("-- Found OpenThreads: "${OPENTHREADS_LIBRARY})
   IF(NOT OPENTHREADS_LIBRARY_DEBUG)
   	MESSAGE("-- Warning Debug OpenThreads not found, using: ${OPENTHREADS_LIBRARY}")
   	SET(OPENTHREADS_LIBRARY_DEBUG "${OPENTHREADS_LIBRARY}")


ENH: Bump ITKUltrasound for itk::ReplaceNonFiniteImageFilter

--- SuperBuild/External_ITKUltrasound.cmake
+++ SuperBuild/External_ITKUltrasound.cmake
@@ -7,8 +7,8 @@
 set(${proj}_DEPENDENCIES )
 ExternalProject_Include_Dependencies(${proj} PROJECT_VAR proj DEPENDS_VAR ${proj}_DEPENDENCIES)

-# disable-wrapping 2016-05-30
-set(${proj}_GIT_TAG e08b714c52bef9fc45cf14558fd7cbfa4e9583df)
+# disable-wrapping 2016-05-31
+set(${proj}_GIT_TAG be0f17713803deaa4f6447245c049519335f6494)
 ExternalProject_Add(${proj}
   ${${proj}_EP_ARGS}
   GIT_REPOSITORY ${git_protocol}://github.com/thewtex/ITKUltrasound.git


Standardize behaviour of graphviz. When GRAPHVIZ_ROOT_DIR cmake var is NOT defined and that dot is in the path now it works.

--- salome_adm/cmake_files/FindGraphviz.cmake
+++ salome_adm/cmake_files/FindGraphviz.cmake
@@ -35,6 +35,14 @@
 FIND_PATH(GRAPHVIZ_INCLUDE_DIR NAMES graphviz/cgraph.h)
 SET(GRAPHVIZ_INCLUDE_DIRS ${GRAPHVIZ_INCLUDE_DIR} ${GRAPHVIZ_INCLUDE_DIR}/graphviz)

+IF(GRAPHVIZ_EXECUTABLE)
+  IF(NOT CMAKE_PREFIX_PATH) # Case where dot is in the path and -DGRAPHVIZ_ROOT_DIR not defined.
+    GET_FILENAME_COMPONENT(GRAPHVIZ_EXECUTABLE_DIR ${GRAPHVIZ_EXECUTABLE} PATH)
+    GET_FILENAME_COMPONENT(GRAPHVIZ_EXECUTABLE_DIR ${GRAPHVIZ_EXECUTABLE_DIR} PATH)
+    SET(CMAKE_PREFIX_PATH "${GRAPHVIZ_EXECUTABLE_DIR}")
+  ENDIF(NOT CMAKE_PREFIX_PATH)
+ENDIF(GRAPHVIZ_EXECUTABLE)
+
 FIND_LIBRARY(GRAPHVIZ_cdt_LIBRARY      NAMES cdt PATH_SUFFIXES bin)
 FIND_LIBRARY(GRAPHVIZ_graph_LIBRARY    NAMES cgraph PATH_SUFFIXES bin)
 FIND_LIBRARY(GRAPHVIZ_gvc_LIBRARY      NAMES gvc PATH_SUFFIXES bin)


Restore make functionaliry.

Restore make functionaliry.

--- src/inserts/build.cmake
+++ src/inserts/build.cmake
@@ -57,12 +57,8 @@
             )
         endif(EXECUTABLE)
     else()
-        set(mc)
-        if (MULTICORE)
-            set(mc -j${N_CORES})
-        endif()
         execute_process(
-            COMMAND make ${mc} -C ${BUILD_DIR}
+            COMMAND make -j${N_CORES} -C ${BUILD_DIR}
             RESULT_VARIABLE ret
         )
     endif()
@@ -74,12 +70,8 @@
             RESULT_VARIABLE ret
         )
     else()
-        set(mc)
-        if (MULTICORE)
-            set(mc -j${N_CORES})
-        endif()
         execute_process(
-            COMMAND make ${mc} -C ${BUILD_DIR}
+            COMMAND make -j${N_CORES} -C ${BUILD_DIR}
             RESULT_VARIABLE ret
         )
     endif()


Fix: Test for noexcept support was too specific BALLConfigNoexcept included a test for the noexcept operator while we only use the noexcept specifier. This prevented `BALL_NOEXCEPT` from being replaced with `noexcept` where it would've been perfectly fine.

--- cmake/BALLConfigNoexcept.cmake
+++ cmake/BALLConfigNoexcept.cmake
@@ -1,6 +1,6 @@
 CHECK_CXX_SOURCE_COMPILES(
 	"template <class T>
-	void self_assign(T& t) noexcept(noexcept(t = t))
+	void self_assign(T& t) noexcept
 	{
 	    t = t;
 	}


[cmake] try to fix build /w CXX

[cmake] try to fix build /w CXX

--- cmake/CMakeListsForTests.cmake
+++ cmake/CMakeListsForTests.cmake
@@ -171,7 +171,13 @@
     ENDIF()

     SET_TESTS_PROPERTIES(${_EXE} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILURE;Exception;failed;ERROR;test unsucceeded")
-    SET_TARGET_PROPERTIES(${_EXE} PROPERTIES LINKER_LANGUAGE CXX)
+
+    # do not enable CXX linker if we don't build cxx code ...
+    SET(WITH_CXX_ @WITH_CXX@)
+    IF(WITH_CXX_)
+      SET_TARGET_PROPERTIES(${_EXE} PROPERTIES LINKER_LANGUAGE CXX)
+    ENDIF(WITH_CXX_)
+
     if(CMAKE_SYSTEM_NAME MATCHES Windows)
       set_tests_properties(${_EXE} PROPERTIES ENVIRONMENT "Path=${COMPONENT_PATH}")
     endif()


Honor 2-digit python version

Honor 2-digit python version

--- cmake/OpenCVDetectPython.cmake
+++ cmake/OpenCVDetectPython.cmake
@@ -19,18 +19,25 @@
 if(PYTHON_EXECUTABLE)
   if(PYTHON_VERSION_STRING)
     set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
-    string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
+    set(PYTHON_VERSION_FULL "${PYTHON_VERSION_STRING}")
   else()
     execute_process(COMMAND ${PYTHON_EXECUTABLE} --version
       ERROR_VARIABLE PYTHON_VERSION_FULL
       ERROR_STRIP_TRAILING_WHITESPACE)

     string(REGEX MATCH "[0-9]+.[0-9]+" PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_FULL}")
-    string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" PYTHON_VERSION_FULL "${PYTHON_VERSION_FULL}")
+  endif()
+
+  if("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+.[0-9]+")
+    set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
+  elseif("${PYTHON_VERSION_FULL}" MATCHES "[0-9]+.[0-9]+")
+    set(PYTHON_VERSION_FULL "${CMAKE_MATCH_0}")
+  else()
+    unset(PYTHON_VERSION_FULL)
   endif()

   if(NOT ANDROID AND NOT IOS)
-    if(CMAKE_VERSION VERSION_GREATER 2.8.8)
+    if(CMAKE_VERSION VERSION_GREATER 2.8.8 AND PYTHON_VERSION_FULL)
       find_host_package(PythonLibs ${PYTHON_VERSION_FULL} EXACT)
     else()
       find_host_package(PythonLibs ${PYTHON_VERSION_FULL})


Fix cmake with Qt 5.11_beta3 (dropping qt5_use_modules)

https://bugzilla.gnome.org/show_bug.cgi?id=795285

--- cmake/modules/FindQt4or5.cmake
+++ cmake/modules/FindQt4or5.cmake
@@ -43,6 +43,16 @@
   foreach(module ${ARGN})
     _qt4or5_component_name_to_qt_component(qt_component ${module})
     list(APPEND ${output_list} ${qt_component})
+    unset(qt_component)
+  endforeach()
+
+  list(REMOVE_DUPLICATES ${output_list})
+endmacro()
+
+macro(_qt5_component_names_to_target_link_libaries output_list)
+  foreach(module ${ARGN})
+    _qt4or5_component_name_to_qt_component(qt_component ${module})
+    list(APPEND ${output_list} Qt5::${qt_component})
     unset(qt_component)
   endforeach()

@@ -195,13 +205,13 @@
     set(modules ${_link_type} ${ARGN})
   endif()

-  _qt4or5_component_names_to_qt_components(real_modules ${modules})
-
   # Verify that Qt5 was found before using qt5_* macros,
   # otherwise cmake will bail out if they are undefined.
   if (${QT_VERSION} STREQUAL "5" AND Qt5Core_FOUND)
-    qt5_use_modules(${_target} ${link_type} ${real_modules})
+    _qt5_component_names_to_target_link_libaries(real_modules ${modules})
+    target_link_libraries(${_target} ${link_type} ${real_modules})
   elseif (${QT_VERSION} STREQUAL "4")
+    _qt4or5_component_names_to_qt_components(real_modules ${modules})
     qt4_use_modules(${_target} ${link_type} ${real_modules})
   endif()
 endfunction()


[CMAKE] Make CXX_FLAGS on Mac cache variables.

On linux, the compiler flags are cache variables, i.e. they can be
overridden by the user. On Mac, that wasn't the case.

--- cmake/modules/SetUpMacOS.cmake
+++ cmake/modules/SetUpMacOS.cmake
@@ -63,12 +63,12 @@
      set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -bind_at_load -m64")

      # Select flags.
-     set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_DEBUG          "-g")
-     set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG")
-     set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-     set(CMAKE_C_FLAGS_DEBUG            "-g")
+     set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Flags for a release build with debug info")
+     set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG"    CACHE STRING "Flags for a release build")
+     set(CMAKE_CXX_FLAGS_DEBUG          "-g"              CACHE STRING "Flags for a debug build")
+     set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG" CACHE STRING "Flags for a release build with debug info")
+     set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG"    CACHE STRING "Flags for a release build")
+     set(CMAKE_C_FLAGS_DEBUG            "-g"              CACHE STRING "Flags for a debug build")
   elseif(${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
      message(STATUS "Found LLVM compiler collection")

@@ -87,12 +87,12 @@
      set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -bind_at_load -m64")

      # Select flags.
-     set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG")
-     set(CMAKE_CXX_FLAGS_DEBUG          "-g")
-     set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG")
-     set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG")
-     set(CMAKE_C_FLAGS_DEBUG            "-g")
+     set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DNDEBUG" CACHE STRING "Flags for a release build with debug info")
+     set(CMAKE_CXX_FLAGS_RELEASE        "-O2 -DNDEBUG"    CACHE STRING "Flags for a release build")
+     set(CMAKE_CXX_FLAGS_DEBUG          "-g"              CACHE STRING "Flags for a debug build")
+     set(CMAKE_C_FLAGS_RELWITHDEBINFO   "-O2 -g -DNDEBUG" CACHE STRING "Flags for a release build with debug info")
+     set(CMAKE_C_FLAGS_RELEASE          "-O2 -DNDEBUG"    CACHE STRING "Flags for a release build")
+     set(CMAKE_C_FLAGS_DEBUG            "-g"              CACHE STRING "Flags for a debug build")
   else()
     MESSAGE(FATAL_ERROR "There is no setup for this compiler with ID=${CMAKE_CXX_COMPILER_ID} up to now. Don't know what to do. Stop cmake at this point.")
   endif()


WRG: update GRM tag

WRG: update GRM tag

--- Modules/Remote/otbGRM.remote.cmake
+++ Modules/Remote/otbGRM.remote.cmake
@@ -31,6 +31,6 @@
 A more detailed description can be found on the project website:
 http://tully.ups-tlse.fr/lassallep/grm
 "
-  GIT_REPOSITORY https://github.com/ctraizet/GRM
-  GIT_TAG 526cfa38d7e08b7b0e8c7b9ec9cbe4a034522491
+  GIT_REPOSITORY https://github.com/orfeotoolbox/GRM
+  GIT_TAG 459943a6fde517cc0dd601dfaca3400e3f1788de
 )


Minor style issue

Minor style issue

--- tests/CMakeBuildTestAddedWhereVerifyScriptExistsVerify.cmake
+++ tests/CMakeBuildTestAddedWhereVerifyScriptExistsVerify.cmake
@@ -17,5 +17,5 @@
                                "^.*${ESCAPED_CMAKE_COMMAND} --build.*$")
 assert_file_has_line_matching ("${TEST_OUTPUT}"
                                "^.*${ESCAPED_CMAKE_TEST_COMMAND}.*$")
-assert_file_has_line_matching ("${TEST_OUTPUT}"
-                               "^.*${ESCAPED_CMAKE_COMMAND}.*P.*SampleTestVerify.*$")+set (VERIFY_REGEX "^.*${ESCAPED_CMAKE_COMMAND}.*P.*SampleTestVerify.*$")
+assert_file_has_line_matching ("${TEST_OUTPUT}" "${VERIFY_REGEX}")


Updated library rpath logic for mac/non-frame build.

--- cmake/CMakeModules/OssimUtilities.cmake
+++ cmake/CMakeModules/OssimUtilities.cmake
@@ -266,10 +266,16 @@
                              BUILD_WITH_INSTALL_RPATH ON
                              INSTALL_NAME_DIR @rpath/Frameworks)
         ELSE(BUILD_OSSIM_FRAMEWORKS)
+          #---
+          # Given install prefix=/usr/local and
+          # install lib dir = lib64 and
+          # link name = libossim.dylib
+          # You get "/usr/local/lib64/libossim.dylib" in the rpath.
+          #---
           SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES
-                             FRAMEWORK FALSE
-                             BUILD_WITH_INSTALL_RPATH ON
-                             INSTALL_NAME_DIR @rpath/lib)
+                                FRAMEWORK FALSE
+                                BUILD_WITH_INSTALL_RPATH ON
+                                INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBRARY_DIR}")
         ENDIF(BUILD_OSSIM_FRAMEWORKS)
       ELSE(BUILD_SHARED_LIBRARY)
           SET_TARGET_PROPERTIES(${LINK_NAME} PROPERTIES


Qt 5.9 Windows: Link to UxTheme

Qt 5.9 Windows: Link to UxTheme

--- cmake/Qt5Widgets_HunterPlugin_5_9.cmake
+++ cmake/Qt5Widgets_HunterPlugin_5_9.cmake
@@ -294,6 +294,9 @@
       "${_qt_install_prefix}/lib/preprocessor.lib"
       "${_qt_install_prefix}/lib/preprocessord.lib"
   )
+
+  # defined: ' __imp__OpenThemeData'
+  _qt_cmake_extra_helpers_add_interface(Qt5::Widgets UxTheme)
 elseif(MINGW)
   _qt_cmake_extra_helpers_add_source(
       Qt5::Widgets


build: repair Windows build

build: repair Windows build

`-ivfsoverlay` is no longer passed through to the driver with
`clang-cl`.  Explicitly mark it as a clang option to ensure that the
option is handled properly.  This repairs the build on Windows.

--- cmake/modules/SwiftWindowsSupport.cmake
+++ cmake/modules/SwiftWindowsSupport.cmake
@@ -71,7 +71,7 @@
                  @ONLY)

   set(${flags}
-      -ivfsoverlay;"${CMAKE_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
+      -Xclang;-ivfsoverlay;-Xclang;"${CMAKE_BINARY_DIR}/windows-sdk-vfs-overlay.yaml"
       PARENT_SCOPE)
 endfunction()


updated android toolchain to include android ndk r10d

--- cmake/toolchain/android.toolchain.cmake
+++ cmake/toolchain/android.toolchain.cmake
@@ -29,12 +29,9 @@
 # POSSIBILITY OF SUCH DAMAGE.

 # ------------------------------------------------------------------------------
-#  Android CMake toolchain file, for use with the Android NDK r5-r9
+#  Android CMake toolchain file, for use with the Android NDK r5-r10d
 #  Requires cmake 2.6.3 or newer (2.8.5 or newer is recommended).
 #  See home page: https://github.com/taka-no-me/android-cmake
-#
-#  The file is mantained by the OpenCV project. The latest version can be get at
-#  http://code.opencv.org/projects/opencv/repository/revisions/master/changes/android/android.toolchain.cmake
 #
 #  Usage Linux:
 #   $ export ANDROID_NDK=/absolute/path/to/the/android-ndk
@@ -50,7 +47,7 @@
 #
 #  Usage Windows:
 #     You need native port of make to build your project.
-#     Android NDK r7 (or newer) already has make.exe on board.
+#     Android NDK r7 (and newer) already has make.exe on board.
 #     For older NDK you have to install it separately.
 #     For example, this one: http://gnuwin32.sourceforge.net/packages/make.htm
 #
@@ -76,36 +73,54 @@
 #      used by ndk-build tool from Android NDK.
 #
 #      Possible targets are:
-#        "armeabi" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "armeabi-v7a" - matches to the NDK ABI with the same name.
-#           See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#        "armeabi" - ARMv5TE based CPU with software floating point operations
+#        "armeabi-v7a" - ARMv7 based devices with hardware FPU instructions
+#            this ABI target is used by default
 #        "armeabi-v7a with NEON" - same as armeabi-v7a, but
 #            sets NEON as floating-point unit
 #        "armeabi-v7a with VFPV3" - same as armeabi-v7a, but
-#            sets VFPV3 as floating-point unit (has 32 registers instead of 16).
-#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP.
-#        "x86" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
-#        "mips" - matches to the NDK ABI with the same name.
-#            See ${ANDROID_NDK}/docs/CPU-ARCH-ABIS.html for the documentation.
+#            sets VFPV3 as floating-point unit (has 32 registers instead of 16)
+#        "armeabi-v6 with VFP" - tuned for ARMv6 processors having VFP
+#        "x86" - IA-32 instruction set
+#        "mips" - MIPS32 instruction set
+#
+#      64-bit ABIs for NDK r10 and newer:
+#        "arm64-v8a" - ARMv8 AArch64 instruction set
+#        "x86_64" - Intel64 instruction set (r1)
+#        "mips64" - MIPS64 instruction set (r6)
 #
 #    ANDROID_NATIVE_API_LEVEL=android-8 - level of Android API compile for.
 #      Option is read-only when standalone toolchain is used.
-#
-#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.6 - the name of compiler
+#      Note: building for "android-L" requires explicit configuration.
+#
+#    ANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 - the name of compiler
 #      toolchain to be used. The list of possible values depends on the NDK
-#      version. For NDK r8c the possible values are:
-#
-#        * arm-linux-androideabi-4.4.3
+#      version. For NDK r10c the possible values are:
+#
+#        * aarch64-linux-android-4.9
+#        * aarch64-linux-android-clang3.4
+#        * aarch64-linux-android-clang3.5
 #        * arm-linux-androideabi-4.6
-#        * arm-linux-androideabi-clang3.1
-#        * mipsel-linux-android-4.4.3
+#        * arm-linux-androideabi-4.8
+#        * arm-linux-androideabi-4.9 (default)
+#        * arm-linux-androideabi-clang3.4
+#        * arm-linux-androideabi-clang3.5
+#        * mips64el-linux-android-4.9
+#        * mips64el-linux-android-clang3.4
+#        * mips64el-linux-android-clang3.5
 #        * mipsel-linux-android-4.6
-#        * mipsel-linux-android-clang3.1
-#        * x86-4.4.3
+#        * mipsel-linux-android-4.8
+#        * mipsel-linux-android-4.9
+#        * mipsel-linux-android-clang3.4
+#        * mipsel-linux-android-clang3.5
 #        * x86-4.6
-#        * x86-clang3.1
+#        * x86-4.8
+#        * x86-4.9
+#        * x86-clang3.4
+#        * x86-clang3.5
+#        * x86_64-4.9
+#        * x86_64-clang3.4
+#        * x86_64-clang3.5
 #
 #    ANDROID_FORCE_ARM_BUILD=OFF - set ON to generate 32-bit ARM instructions
 #      instead of Thumb. Is not available for "x86" (inapplicable) and
@@ -181,8 +196,9 @@
 #    ANDROID and BUILD_ANDROID will be set to true, you may test any of these
 #    variables to make necessary Android-specific configuration changes.
 #
-#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS will be set true, mutually
-#    exclusive. NEON option will be set true if VFP is set to NEON.
+#    Also ARMEABI or ARMEABI_V7A or X86 or MIPS or ARM64_V8A or X86_64 or MIPS64
+#    will be set true, mutually exclusive. NEON option will be set true
+#    if VFP is set to NEON.
 #
 #    LIBRARY_OUTPUT_PATH_ROOT should be set in cache to determine where Android
 #    libraries will be installed.
@@ -190,117 +206,6 @@
 #    under the ${LIBRARY_OUTPUT_PATH_ROOT}/libs/${ANDROID_NDK_ABI_NAME}
 #    (depending on the target ABI). This is convenient for Android packaging.
 #
-#  Change Log:
-#   - initial version December 2010
-#   - April 2011
-#     [+] added possibility to build with NDK (without standalone toolchain)
-#     [+] support cross-compilation on Windows (native, no cygwin support)
-#     [+] added compiler option to force "char" type to be signed
-#     [+] added toolchain option to compile to 32-bit ARM instructions
-#     [+] added toolchain option to disable SWIG search
-#     [+] added platform "armeabi-v7a with VFPV3"
-#     [~] ARM_TARGETS renamed to ARM_TARGET
-#     [+] EXECUTABLE_OUTPUT_PATH is set by toolchain (required on Windows)
-#     [~] Fixed bug with ANDROID_API_LEVEL variable
-#     [~] turn off SWIG search if it is not found first time
-#   - May 2011
-#     [~] ANDROID_LEVEL is renamed to ANDROID_API_LEVEL
-#     [+] ANDROID_API_LEVEL is detected by toolchain if not specified
-#     [~] added guard to prevent changing of output directories on the first
-#         cmake pass
-#     [~] toolchain exits with error if ARM_TARGET is not recognized
-#   - June 2011
-#     [~] default NDK path is updated for version r5c
-#     [+] variable CMAKE_SYSTEM_PROCESSOR is set based on ARM_TARGET
-#     [~] toolchain install directory is added to linker paths
-#     [-] removed SWIG-related stuff from toolchain
-#     [+] added macro find_host_package, find_host_program to search
-#         packages/programs on the host system
-#     [~] fixed path to STL library
-#   - July 2011
-#     [~] fixed options caching
-#     [~] search for all supported NDK versions
-#     [~] allowed spaces in NDK path
-#   - September 2011
-#     [~] updated for NDK r6b
-#   - November 2011
-#     [*] rewritten for NDK r7
-#     [+] x86 toolchain support (experimental)
-#     [+] added "armeabi-v6 with VFP" ABI for ARMv6 processors.
-#     [~] improved compiler and linker flags management
-#     [+] support different build flags for Release and Debug configurations
-#     [~] by default compiler flags the same as used by ndk-build (but only
-#         where reasonable)
-#     [~] ANDROID_NDK_TOOLCHAIN_ROOT is splitted to ANDROID_STANDALONE_TOOLCHAIN
-#         and ANDROID_TOOLCHAIN_ROOT
-#     [~] ARM_TARGET is renamed to ANDROID_ABI
-#     [~] ARMEABI_NDK_NAME is renamed to ANDROID_NDK_ABI_NAME
-#     [~] ANDROID_API_LEVEL is renamed to ANDROID_NATIVE_API_LEVEL
-#   - January 2012
-#     [+] added stlport_static support (experimental)
-#     [+] added special check for cygwin
-#     [+] filtered out hidden files (starting with .) while globbing inside NDK
-#     [+] automatically applied GLESv2 linkage fix for NDK revisions 5-6
-#     [+] added ANDROID_GET_ABI_RAWNAME to get NDK ABI names by CMake flags
-#   - February 2012
-#     [+] updated for NDK r7b
-#     [~] fixed cmake try_compile() command
-#     [~] Fix for missing install_name_tool on OS X
-#   - March 2012
-#     [~] fixed incorrect C compiler flags
-#     [~] fixed CMAKE_SYSTEM_PROCESSOR change on ANDROID_ABI change
-#     [+] improved toolchain loading speed
-#     [+] added assembler language support (.S)
-#     [+] allowed preset search paths and extra search suffixes
-#   - April 2012
-#     [+] updated for NDK r7c
-#     [~] fixed most of problems with compiler/linker flags and caching
-#     [+] added option ANDROID_FUNCTION_LEVEL_LINKING
-#   - May 2012
-#     [+] updated for NDK r8
-#     [+] added mips architecture support
-#   - August 2012
-#     [+] updated for NDK r8b
-#     [~] all intermediate files generated by toolchain are moved to CMakeFiles
-#     [~] libstdc++ and libsupc are removed from explicit link libraries
-#     [+] added CCache support (via NDK_CCACHE environment or cmake variable)
-#     [+] added gold linker support for NDK r8b
-#     [~] fixed mips linker flags for NDK r8b
-#   - September 2012
-#     [+] added NDK release name detection (see ANDROID_NDK_RELEASE)
-#     [+] added support for all C++ runtimes from NDK
-#         (system, gabi++, stlport, gnustl)
-#     [+] improved warnings on known issues of NDKs
-#     [~] use gold linker as default if available (NDK r8b)
-#     [~] globally turned off rpath
-#     [~] compiler options are aligned with NDK r8b
-#   - October 2012
-#     [~] fixed C++ linking: explicitly link with math library (OpenCV #2426)
-#   - November 2012
-#     [+] updated for NDK r8c
-#     [+] added support for clang compiler
-#   - December 2012
-#     [+] suppress warning about unused CMAKE_TOOLCHAIN_FILE variable
-#     [+] adjust API level to closest compatible as NDK does
-#     [~] fixed ccache full path search
-#     [+] updated for NDK r8d
-#     [~] compiler options are aligned with NDK r8d
-#   - March 2013
-#     [+] updated for NDK r8e (x86 version)
-#     [+] support x86_64 version of NDK
-#   - April 2013
-#     [+] support non-release NDK layouts (from Linaro git and Android git)
-#     [~] automatically detect if explicit link to crtbegin_*.o is needed
-#   - June 2013
-#     [~] fixed stl include path for standalone toolchain made by NDK >= r8c
-#   - July 2013
-#     [+] updated for NDK r9
-#   - November 2013
-#     [+] updated for NDK r9b
-#   - December 2013
-#     [+] updated for NDK r9c
-#   - January 2014
-#     [~] fix copying of shared STL
 # ------------------------------------------------------------------------------

 cmake_minimum_required( VERSION 2.6.3 )
@@ -311,23 +216,31 @@
 endif()

 if( CMAKE_TOOLCHAIN_FILE )
- # touch toolchain variable only to suppress "unused variable" warning
-endif()
-
+ # touch toolchain variable to suppress "unused variable" warning
+endif()
+
+# inherit settings in recursive loads
 get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
 if( _CMAKE_IN_TRY_COMPILE )
  include( "${CMAKE_CURRENT_SOURCE_DIR}/../android.toolchain.config.cmake" OPTIONAL )
 endif()

 # this one is important
-set( CMAKE_SYSTEM_NAME Linux )
+if( CMAKE_VERSION VERSION_GREATER "3.0.99" )
+ set( CMAKE_SYSTEM_NAME Android )
+else()
+ set( CMAKE_SYSTEM_NAME Linux )
+endif()
+
 # this one not so much
 set( CMAKE_SYSTEM_VERSION 1 )

 # rpath makes low sence for Android
+set( CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "" )
 set( CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries." )

-set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
+# NDK search paths
+set( ANDROID_SUPPORTED_NDK_VERSIONS ${ANDROID_EXTRA_NDK_VERSIONS} -r10d -r10c -r10b -r10 -r9d -r9c -r9b -r9 -r8e -r8d -r8c -r8b -r8 -r7c -r7b -r7 -r6b -r6 -r5c -r5b -r5 "" )
 if(NOT DEFINED ANDROID_NDK_SEARCH_PATHS)
  if( CMAKE_HOST_WIN32 )
   file( TO_CMAKE_PATH "$ENV{PROGRAMFILES}" ANDROID_NDK_SEARCH_PATHS )
@@ -341,13 +254,21 @@
  set( ANDROID_STANDALONE_TOOLCHAIN_SEARCH_PATH /opt/android-toolchain )
 endif()

+# known ABIs
 set( ANDROID_SUPPORTED_ABIS_arm "armeabi-v7a;armeabi;armeabi-v7a with NEON;armeabi-v7a with VFPV3;armeabi-v6 with VFP" )
+set( ANDROID_SUPPORTED_ABIS_arm64 "arm64-v8a" )
 set( ANDROID_SUPPORTED_ABIS_x86 "x86" )
-set( ANDROID_SUPPORTED_ABIS_mipsel "mips" )
-
+set( ANDROID_SUPPORTED_ABIS_x86_64 "x86_64" )
+set( ANDROID_SUPPORTED_ABIS_mips "mips" )
+set( ANDROID_SUPPORTED_ABIS_mips64 "mips64" )
+
+# API level defaults
 set( ANDROID_DEFAULT_NDK_API_LEVEL 8 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_arm64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_x86 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_x86_64 21 )
 set( ANDROID_DEFAULT_NDK_API_LEVEL_mips 9 )
+set( ANDROID_DEFAULT_NDK_API_LEVEL_mips64 21 )

 macro( __LIST_FILTER listvar regex )
@@ -423,7 +344,7 @@
 endmacro()

 macro( __DETECT_NATIVE_API_LEVEL _var _path )
- SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*$" )
+ SET( __ndkApiLevelRegex "^[\t ]*#define[\t ]+__ANDROID_API__[\t ]+([0-9]+)[\t ]*.*$" )
  FILE( STRINGS ${_path} __apiFileContent REGEX "${__ndkApiLevelRegex}" )
  if( NOT __apiFileContent )
   message( SEND_ERROR "Could not get Android native API level. Probably you have specified invalid level value, or your copy of NDK/toolchain is broken." )
@@ -535,12 +456,15 @@
  set( ANDROID_NDK "${ANDROID_NDK}" CACHE INTERNAL "Path of the Android NDK" FORCE )
  set( BUILD_WITH_ANDROID_NDK True )
  if( EXISTS "${ANDROID_NDK}/RELEASE.TXT" )
-  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX r[0-9]+[a-z]? )
-  string( REGEX MATCH r[0-9]+[a-z]? ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
+  file( STRINGS "${ANDROID_NDK}/RELEASE.TXT" ANDROID_NDK_RELEASE_FULL LIMIT_COUNT 1 REGEX "r[0-9]+[a-z]?" )
+  string( REGEX MATCH "r([0-9]+)([a-z]?)" ANDROID_NDK_RELEASE "${ANDROID_NDK_RELEASE_FULL}" )
  else()
   set( ANDROID_NDK_RELEASE "r1x" )
   set( ANDROID_NDK_RELEASE_FULL "unreleased" )
  endif()
+ string( REGEX REPLACE "r([0-9]+)([a-z]?)" "\\1*1000" ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE}" )
+ string( FIND " abcdefghijklmnopqastuvwxyz" "${CMAKE_MATCH_2}" __ndkReleaseLetterNum )
+ math( EXPR ANDROID_NDK_RELEASE_NUM "${ANDROID_NDK_RELEASE_NUM}+${__ndkReleaseLetterNum}" )
 elseif( ANDROID_STANDALONE_TOOLCHAIN )
  get_filename_component( ANDROID_STANDALONE_TOOLCHAIN "${ANDROID_STANDALONE_TOOLCHAIN}" ABSOLUTE )
  # try to detect change
@@ -621,12 +545,18 @@
  if( NOT __availableToolchainMachines )
   message( FATAL_ERROR "Could not determine machine name of your toolchain. Probably your Android standalone toolchain is broken." )
  endif()
- if( __availableToolchainMachines MATCHES i686 )
+ if( __availableToolchainMachines MATCHES x86_64 )
+  set( __availableToolchainArchs "x86_64" )
+ elseif( __availableToolchainMachines MATCHES i686 )
   set( __availableToolchainArchs "x86" )
+ elseif( __availableToolchainMachines MATCHES aarch64 )
+  set( __availableToolchainArchs "arm64" )
  elseif( __availableToolchainMachines MATCHES arm )
   set( __availableToolchainArchs "arm" )
+ elseif( __availableToolchainMachines MATCHES mips64el )
+  set( __availableToolchainArchs "mips64" )
  elseif( __availableToolchainMachines MATCHES mipsel )
-  set( __availableToolchainArchs "mipsel" )
+  set( __availableToolchainArchs "mips" )
  endif()
  execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" -dumpversion
                   OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )
@@ -642,24 +572,44 @@
 macro( __GLOB_NDK_TOOLCHAINS __availableToolchainsVar __availableToolchainsLst __toolchain_subpath )
  foreach( __toolchain ${${__availableToolchainsLst}} )
   if( "${__toolchain}" MATCHES "-clang3[.][0-9]$" AND NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}${__toolchain_subpath}" )
-   string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   SET( __toolchainVersionRegex "^TOOLCHAIN_VERSION[\t ]+:=[\t ]+(.*)$" )
+   FILE( STRINGS "${ANDROID_NDK_TOOLCHAINS_PATH}/${__toolchain}/setup.mk" __toolchainVersionStr REGEX "${__toolchainVersionRegex}" )
+   if( __toolchainVersionStr )
+    string( REGEX REPLACE "${__toolchainVersionRegex}" "\\1" __toolchainVersionStr "${__toolchainVersionStr}" )
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-${__toolchainVersionStr}" __gcc_toolchain "${__toolchain}" )
+   else()
+    string( REGEX REPLACE "-clang3[.][0-9]$" "-4.6" __gcc_toolchain "${__toolchain}" )
+   endif()
+   unset( __toolchainVersionStr )
+   unset( __toolchainVersionRegex )
   else()
    set( __gcc_toolchain "${__toolchain}" )
   endif()
   __DETECT_TOOLCHAIN_MACHINE_NAME( __machine "${ANDROID_NDK_TOOLCHAINS_PATH}/${__gcc_toolchain}${__toolchain_subpath}" )
   if( __machine )
    string( REGEX MATCH "[0-9]+[.][0-9]+([.][0-9x]+)?$" __version "${__gcc_toolchain}" )
-   if( __machine MATCHES i686 )
+   if( __machine MATCHES x86_64 )
+    set( __arch "x86_64" )
+   elseif( __machine MATCHES i686 )
     set( __arch "x86" )
+   elseif( __machine MATCHES aarch64 )
+    set( __arch "arm64" )
    elseif( __machine MATCHES arm )
     set( __arch "arm" )
+   elseif( __machine MATCHES mips64el )
+    set( __arch "mips64" )
    elseif( __machine MATCHES mipsel )
-    set( __arch "mipsel" )
+    set( __arch "mips" )
+   else()
+    set( __arch "" )
    endif()
-   list( APPEND __availableToolchainMachines "${__machine}" )
-   list( APPEND __availableToolchainArchs "${__arch}" )
-   list( APPEND __availableToolchainCompilerVersions "${__version}" )
-   list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   #message("machine: !${__machine}!\narch: !${__arch}!\nversion: !${__version}!\ntoolchain: !${__toolchain}!\n")
+   if (__arch)
+    list( APPEND __availableToolchainMachines "${__machine}" )
+    list( APPEND __availableToolchainArchs "${__arch}" )
+    list( APPEND __availableToolchainCompilerVersions "${__version}" )
+    list( APPEND ${__availableToolchainsVar} "${__toolchain}" )
+   endif()
   endif()
   unset( __gcc_toolchain )
  endforeach()
@@ -735,28 +685,45 @@
  set( X86 true )
  set( ANDROID_NDK_ABI_NAME "x86" )
  set( ANDROID_ARCH_NAME "x86" )
- set( ANDROID_ARCH_FULLNAME "x86" )
  set( ANDROID_LLVM_TRIPLE "i686-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "i686" )
+elseif( ANDROID_ABI STREQUAL "x86_64" )
+ set( X86 true )
+ set( X86_64 true )
+ set( ANDROID_NDK_ABI_NAME "x86_64" )
+ set( ANDROID_ARCH_NAME "x86_64" )
+ set( CMAKE_SYSTEM_PROCESSOR "x86_64" )
+ set( ANDROID_LLVM_TRIPLE "x86_64-none-linux-android" )
+elseif( ANDROID_ABI STREQUAL "mips64" )
+ set( MIPS64 true )
+ set( ANDROID_NDK_ABI_NAME "mips64" )
+ set( ANDROID_ARCH_NAME "mips64" )
+ set( ANDROID_LLVM_TRIPLE "mips64el-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "mips64" )
 elseif( ANDROID_ABI STREQUAL "mips" )
  set( MIPS true )
  set( ANDROID_NDK_ABI_NAME "mips" )
  set( ANDROID_ARCH_NAME "mips" )
- set( ANDROID_ARCH_FULLNAME "mipsel" )
  set( ANDROID_LLVM_TRIPLE "mipsel-none-linux-android" )
  set( CMAKE_SYSTEM_PROCESSOR "mips" )
+elseif( ANDROID_ABI STREQUAL "arm64-v8a" )
+ set( ARM64_V8A true )
+ set( ANDROID_NDK_ABI_NAME "arm64-v8a" )
+ set( ANDROID_ARCH_NAME "arm64" )
+ set( ANDROID_LLVM_TRIPLE "aarch64-none-linux-android" )
+ set( CMAKE_SYSTEM_PROCESSOR "aarch64" )
+ set( VFPV3 true )
+ set( NEON true )
 elseif( ANDROID_ABI STREQUAL "armeabi" )
  set( ARMEABI true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv5te" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v6 with VFP" )
  set( ARMEABI_V6 true )
  set( ANDROID_NDK_ABI_NAME "armeabi" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv5te-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv6" )
  # need always fallback to older platform
@@ -765,14 +732,12 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
 elseif( ANDROID_ABI STREQUAL "armeabi-v7a with VFPV3" )
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -780,7 +745,6 @@
  set( ARMEABI_V7A true )
  set( ANDROID_NDK_ABI_NAME "armeabi-v7a" )
  set( ANDROID_ARCH_NAME "arm" )
- set( ANDROID_ARCH_FULLNAME "arm" )
  set( ANDROID_LLVM_TRIPLE "armv7-none-linux-androideabi" )
  set( CMAKE_SYSTEM_PROCESSOR "armv7-a" )
  set( VFPV3 true )
@@ -814,7 +778,7 @@
 To configure the toolchain set CMake variable ANDROID_TOOLCHAIN_NAME to one of the following values:\n${toolchains_list}\n" )
  endif()
  list( GET __availableToolchainArchs ${__toolchainIdx} __toolchainArch )
- if( NOT __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+ if( NOT __toolchainArch STREQUAL ANDROID_ARCH_NAME )
   message( SEND_ERROR "Selected toolchain \"${ANDROID_TOOLCHAIN_NAME}\" is not able to compile binaries for the \"${ANDROID_ARCH_NAME}\" platform." )
  endif()
 else()
@@ -825,7 +789,7 @@
  math( EXPR __availableToolchainsCount "${__availableToolchainsCount}-1" )
  foreach( __idx RANGE ${__availableToolchainsCount} )
   list( GET __availableToolchainArchs ${__idx} __toolchainArch )
-  if( __toolchainArch STREQUAL ANDROID_ARCH_FULLNAME )
+  if( __toolchainArch STREQUAL ANDROID_ARCH_NAME )
    list( GET __availableToolchainCompilerVersions ${__idx} __toolchainVersion )
    string( REPLACE "x" "99" __toolchainVersion "${__toolchainVersion}")
    if( __toolchainVersion VERSION_GREATER __toolchainMaxVersion )
@@ -854,15 +818,16 @@

 # choose native API level
 __INIT_VARIABLE( ANDROID_NATIVE_API_LEVEL ENV_ANDROID_NATIVE_API_LEVEL ANDROID_API_LEVEL ENV_ANDROID_API_LEVEL ANDROID_STANDALONE_TOOLCHAIN_API_LEVEL ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME} ANDROID_DEFAULT_NDK_API_LEVEL )
-string( REGEX MATCH "[0-9]+" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( REPLACE "android-" "" ANDROID_NATIVE_API_LEVEL "${ANDROID_NATIVE_API_LEVEL}" )
+string( STRIP "${ANDROID_NATIVE_API_LEVEL}" ANDROID_NATIVE_API_LEVEL )
 # adjust API level
 set( __real_api_level ${ANDROID_DEFAULT_NDK_API_LEVEL_${ANDROID_ARCH_NAME}} )
 foreach( __level ${ANDROID_SUPPORTED_NATIVE_API_LEVELS} )
- if( NOT __level GREATER ANDROID_NATIVE_API_LEVEL AND NOT __level LESS __real_api_level )
+ if( (__level LESS ANDROID_NATIVE_API_LEVEL OR __level STREQUAL ANDROID_NATIVE_API_LEVEL) AND NOT __level LESS __real_api_level )
   set( __real_api_level ${__level} )
  endif()
 endforeach()
-if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL EQUAL __real_api_level )
+if( __real_api_level AND NOT ANDROID_NATIVE_API_LEVEL STREQUAL __real_api_level )
  message( STATUS "Adjusting Android API level 'android-${ANDROID_NATIVE_API_LEVEL}' to 'android-${__real_api_level}'")
  set( ANDROID_NATIVE_API_LEVEL ${__real_api_level} )
 endif()
@@ -874,7 +839,7 @@
 else()
  if( BUILD_WITH_ANDROID_NDK )
   __DETECT_NATIVE_API_LEVEL( __realApiLevel "${ANDROID_NDK}/platforms/android-${ANDROID_NATIVE_API_LEVEL}/arch-${ANDROID_ARCH_NAME}/usr/include/android/api-level.h" )
-  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL )
+  if( NOT __realApiLevel EQUAL ANDROID_NATIVE_API_LEVEL AND NOT __realApiLevel GREATER 9000 )
    message( SEND_ERROR "Specified Android API level (${ANDROID_NATIVE_API_LEVEL}) does not match to the level found (${__realApiLevel}). Probably your copy of NDK is broken." )
   endif()
   unset( __realApiLevel )
@@ -891,8 +856,8 @@
 # remember target ABI
 set( ANDROID_ABI "${ANDROID_ABI}" CACHE STRING "The target ABI for Android. If arm, then armeabi-v7a is recommended for hardware floating point." FORCE )
 if( CMAKE_VERSION VERSION_GREATER "2.8" )
- list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME} )
- set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_FULLNAME}} )
+ list( SORT ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME} )
+ set_property( CACHE ANDROID_ABI PROPERTY STRINGS ${ANDROID_SUPPORTED_ABIS_${ANDROID_ARCH_NAME}} )
 endif()

@@ -1034,7 +999,7 @@
  string( REGEX MATCH "[0-9]+[.][0-9]+" ANDROID_CLANG_VERSION "${ANDROID_CLANG_VERSION}")
 elseif( "${ANDROID_TOOLCHAIN_NAME}" MATCHES "-clang3[.][0-9]?$" )
  string( REGEX MATCH "3[.][0-9]$" ANDROID_CLANG_VERSION "${ANDROID_TOOLCHAIN_NAME}")
- string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-4.6" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
+ string( REGEX REPLACE "-clang${ANDROID_CLANG_VERSION}$" "-${ANDROID_COMPILER_VERSION}" ANDROID_GCC_TOOLCHAIN_NAME "${ANDROID_TOOLCHAIN_NAME}" )
  if( NOT EXISTS "${ANDROID_NDK_TOOLCHAINS_PATH}/llvm-${ANDROID_CLANG_VERSION}${ANDROID_NDK_TOOLCHAINS_SUBPATH}/bin/clang${TOOL_OS_SUFFIX}" )
   message( FATAL_ERROR "Could not find the Clang compiler driver" )
  endif()
@@ -1067,7 +1032,7 @@
   set( ANDROID_EXCEPTIONS       ON )
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/system/include" )
  elseif( ANDROID_STL MATCHES "gabi" )
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    message( FATAL_ERROR "gabi++ is not awailable in your NDK. You have to upgrade to NDK r7 or newer to use gabi++.")
   endif()
   set( ANDROID_RTTI             ON )
@@ -1075,12 +1040,12 @@
   set( ANDROID_STL_INCLUDE_DIRS "${ANDROID_NDK}/sources/cxx-stl/gabi++/include" )
   set( __libstl                 "${ANDROID_NDK}/sources/cxx-stl/gabi++/libs/${ANDROID_NDK_ABI_NAME}/libgabi++_static.a" )
  elseif( ANDROID_STL MATCHES "stlport" )
-  if( NOT ANDROID_NDK_RELEASE STRLESS "r8d" )
+  if( NOT ANDROID_NDK_RELEASE_NUM LESS 8004 ) # before r8d
    set( ANDROID_EXCEPTIONS       ON )
   else()
    set( ANDROID_EXCEPTIONS       OFF )
   endif()
-  if( ANDROID_NDK_RELEASE STRLESS "r7" )
+  if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
    set( ANDROID_RTTI            OFF )
   else()
    set( ANDROID_RTTI            ON )
@@ -1101,7 +1066,7 @@
   else()
    set( __libstl                "${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++" )
   endif()
-  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" )
+  set( ANDROID_STL_INCLUDE_DIRS "${__libstl}/include" "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/include" "${__libstl}/include/backward" )
   if( EXISTS "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
    set( __libstl                "${__libstl}/libs/${ANDROID_NDK_ABI_NAME}/libgnustl_static.a" )
   else()
@@ -1203,10 +1168,14 @@
 include( CMakeForceCompiler )
 CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU )
 if( ANDROID_COMPILER_IS_CLANG )
- set( CMAKE_C_COMPILER_ID Clang)
+ set( CMAKE_C_COMPILER_ID Clang )
 endif()
 set( CMAKE_C_PLATFORM_ID Linux )
-set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+if( X86_64 OR MIPS64 OR ARM64_V8A )
+ set( CMAKE_C_SIZEOF_DATA_PTR 8 )
+else()
+ set( CMAKE_C_SIZEOF_DATA_PTR 4 )
+endif()
 set( CMAKE_C_HAS_ISYSROOT 1 )
 set( CMAKE_C_COMPILER_ABI ELF )
 CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU )
@@ -1214,7 +1183,7 @@
  set( CMAKE_CXX_COMPILER_ID Clang)
 endif()
 set( CMAKE_CXX_PLATFORM_ID Linux )
-set( CMAKE_CXX_SIZEOF_DATA_PTR 4 )
+set( CMAKE_CXX_SIZEOF_DATA_PTR ${CMAKE_C_SIZEOF_DATA_PTR} )
 set( CMAKE_CXX_HAS_ISYSROOT 1 )
 set( CMAKE_CXX_COMPILER_ABI ELF )
 set( CMAKE_CXX_SOURCE_FILE_EXTENSIONS cc cp cxx cpp CPP c++ C )
@@ -1225,6 +1194,14 @@
 set( CMAKE_ASM_COMPILER_FORCED TRUE )
 set( CMAKE_COMPILER_IS_GNUASM 1)
 set( CMAKE_ASM_SOURCE_FILE_EXTENSIONS s S asm )
+
+foreach( lang C CXX ASM )
+ if( ANDROID_COMPILER_IS_CLANG )
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_CLANG_VERSION} )
+ else()
+  set( CMAKE_${lang}_COMPILER_VERSION ${ANDROID_COMPILER_VERSION} )
+ endif()
+endforeach()

 # flags and definitions
 remove_definitions( -DANDROID )
@@ -1255,8 +1232,15 @@
 endif()

 # NDK flags
-if( ARMEABI OR ARMEABI_V7A )
- set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fpic -funwind-tables" )
+if (ARM64_V8A )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -ffunction-sections -funwind-tables" )
+ set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
+ set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
+ if( NOT ANDROID_COMPILER_IS_CLANG )
+  set( ANDROID_CXX_FLAGS_RELEASE "${ANDROID_CXX_FLAGS_RELEASE} -funswitch-loops -finline-limit=300" )
+ endif()
+elseif( ARMEABI OR ARMEABI_V7A)
+ set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_FORCE_ARM_BUILD AND NOT ARMEABI_V6 )
   set( ANDROID_CXX_FLAGS_RELEASE "-mthumb -fomit-frame-pointer -fno-strict-aliasing" )
   set( ANDROID_CXX_FLAGS_DEBUG   "-marm -fno-omit-frame-pointer -fno-strict-aliasing" )
@@ -1271,17 +1255,15 @@
    set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
   endif()
  endif()
-elseif( X86 )
+elseif( X86 OR X86_64 )
  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
   set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funswitch-loops -finline-limit=300" )
- else()
-  set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -fPIC" )
  endif()
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer -fstrict-aliasing" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer -fno-strict-aliasing" )
-elseif( MIPS )
- set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
+elseif( MIPS OR MIPS64 )
+ set( ANDROID_CXX_FLAGS         "${ANDROID_CXX_FLAGS} -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0" )
  set( ANDROID_CXX_FLAGS_RELEASE "-fomit-frame-pointer" )
  set( ANDROID_CXX_FLAGS_DEBUG   "-fno-omit-frame-pointer" )
  if( NOT ANDROID_COMPILER_IS_CLANG )
@@ -1359,7 +1341,7 @@
 endif()

 # variables controlling optional build flags
-if (ANDROID_NDK_RELEASE STRLESS "r7")
+if( ANDROID_NDK_RELEASE_NUM LESS 7000 ) # before r7
  # libGLESv2.so in NDK's prior to r7 refers to missing external symbols.
  # So this flag option is required for all projects using OpenGL from native.
  __INIT_VARIABLE( ANDROID_SO_UNDEFINED                      VALUES ON )
@@ -1375,7 +1357,7 @@
 set( ANDROID_NO_UNDEFINED           ${ANDROID_NO_UNDEFINED}           CACHE BOOL "Show all undefined symbols as linker errors" )
 set( ANDROID_SO_UNDEFINED           ${ANDROID_SO_UNDEFINED}           CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
 set( ANDROID_FUNCTION_LEVEL_LINKING ${ANDROID_FUNCTION_LEVEL_LINKING} CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
-set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker (only avaialble for NDK r8b for ARM and x86 architectures on linux-86 and darwin-x86 hosts)" )
+set( ANDROID_GOLD_LINKER            ${ANDROID_GOLD_LINKER}            CACHE BOOL "Enables gold linker" )
 set( ANDROID_NOEXECSTACK            ${ANDROID_NOEXECSTACK}            CACHE BOOL "Allows or disallows undefined symbols in shared libraries" )
 set( ANDROID_RELRO                  ${ANDROID_RELRO}                  CACHE BOOL "Enables RELRO - a memory corruption mitigation technique" )
 mark_as_advanced( ANDROID_NO_UNDEFINED ANDROID_SO_UNDEFINED ANDROID_FUNCTION_LEVEL_LINKING ANDROID_GOLD_LINKER ANDROID_NOEXECSTACK ANDROID_RELRO )
@@ -1410,9 +1392,9 @@
 endif()

 if( ANDROID_COMPILER_VERSION VERSION_EQUAL "4.6" )
- if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE STRGREATER "r8b") AND (ARMEABI OR ARMEABI_V7A OR X86) )
+ if( ANDROID_GOLD_LINKER AND (CMAKE_HOST_UNIX OR ANDROID_NDK_RELEASE_NUM GREATER 8002) AND (ARMEABI OR ARMEABI_V7A OR X86) )
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=gold" )
- elseif( ANDROID_NDK_RELEASE STRGREATER "r8b")
+ elseif( ANDROID_NDK_RELEASE_NUM GREATER 8002 ) # after r8b
   set( ANDROID_LINKER_FLAGS "${ANDROID_LINKER_FLAGS} -fuse-ld=bfd" )
  elseif( ANDROID_NDK_RELEASE STREQUAL "r8b" AND ARMEABI AND NOT _CMAKE_IN_TRY_COMPILE )
   message( WARNING "The default bfd linker from arm GCC 4.6 toolchain can fail with 'unresolvable R_ARM_THM_CALL relocation' error message. See https://code.google.com/p/android/issues/detail?id=35342
@@ -1436,13 +1418,7 @@
 endif()

 if( ANDROID_COMPILER_IS_CLANG )
- set( ANDROID_CXX_FLAGS "-Qunused-arguments ${ANDROID_CXX_FLAGS}" )
- if( ARMEABI_V7A AND NOT ANDROID_FORCE_ARM_BUILD )
-  set( ANDROID_CXX_FLAGS_RELEASE "-target thumbv7-none-linux-androideabi ${ANDROID_CXX_FLAGS_RELEASE}" )
-  set( ANDROID_CXX_FLAGS_DEBUG   "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS_DEBUG}" )
- else()
-  set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} ${ANDROID_CXX_FLAGS}" )
- endif()
+ set( ANDROID_CXX_FLAGS "-target ${ANDROID_LLVM_TRIPLE} -Qunused-arguments ${ANDROID_CXX_FLAGS}" )
  if( BUILD_WITH_ANDROID_NDK )
   set( ANDROID_CXX_FLAGS "-gcc-toolchain ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_CXX_FLAGS}" )
  endif()
@@ -1484,6 +1460,16 @@
  set( CMAKE_SHARED_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_SHARED_LINKER_FLAGS}" )
  set( CMAKE_MODULE_LINKER_FLAGS "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.xsc ${CMAKE_MODULE_LINKER_FLAGS}" )
  set( CMAKE_EXE_LINKER_FLAGS    "-Wl,-T,${ANDROID_NDK_TOOLCHAINS_PATH}/${ANDROID_GCC_TOOLCHAIN_NAME}/mipself.x ${CMAKE_EXE_LINKER_FLAGS}" )
+endif()
+
+# pie/pic
+if( NOT (ANDROID_NATIVE_API_LEVEL LESS 16) AND (NOT DEFINED ANDROID_APP_PIE OR ANDROID_APP_PIE) AND (CMAKE_VERSION VERSION_GREATER 2.8.8) )
+ set( CMAKE_POSITION_INDEPENDENT_CODE TRUE )
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIE -pie")
+else()
+ set( CMAKE_POSITION_INDEPENDENT_CODE FALSE )
+ set( CMAKE_CXX_FLAGS "-fpic ${CMAKE_CXX_FLAGS}" )
+ set( CMAKE_C_FLAGS   "-fpic ${CMAKE_C_FLAGS}" )
 endif()

 # configure rtti
@@ -1667,6 +1653,7 @@
                 ANDROID_RELRO
                 ANDROID_LIBM_PATH
                 ANDROID_EXPLICIT_CRT_LINK
+                ANDROID_APP_PIE
                 )
   if( DEFINED ${__var} )
    if( "${__var}" MATCHES " ")
@@ -1705,8 +1692,8 @@

 # Variables controlling behavior or set by cmake toolchain:
-#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips"
-#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14 (depends on NDK version)
+#   ANDROID_ABI : "armeabi-v7a" (default), "armeabi", "armeabi-v7a with NEON", "armeabi-v7a with VFPV3", "armeabi-v6 with VFP", "x86", "mips", "arm64-v8a", "x86_64", "mips64"
+#   ANDROID_NATIVE_API_LEVEL : 3,4,5,8,9,14,15,16,17,18,19,21 (depends on NDK version)
 #   ANDROID_STL : gnustl_static/gnustl_shared/stlport_static/stlport_shared/gabi++_static/gabi++_shared/system_re/system/none
 #   ANDROID_FORBID_SYGWIN : ON/OFF
 #   ANDROID_NO_UNDEFINED : ON/OFF
@@ -1739,17 +1726,21 @@
 #   ARMEABI : TRUE for arm v6 and older devices
 #   ARMEABI_V6 : TRUE for arm v6
 #   ARMEABI_V7A : TRUE for arm v7a
+#   ARM64_V8A : TRUE for arm64-v8a
 #   NEON : TRUE if NEON unit is enabled
 #   VFPV3 : TRUE if VFP version 3 is enabled
 #   X86 : TRUE if configured for x86
+#   X86_64 : TRUE if configured for x86_64
 #   MIPS : TRUE if configured for mips
+#   MIPS64 : TRUE if configured for mips64
 #   BUILD_ANDROID : always TRUE
 #   BUILD_WITH_ANDROID_NDK : TRUE if NDK is used
 #   BUILD_WITH_STANDALONE_TOOLCHAIN : TRUE if standalone toolchain is used
 #   ANDROID_NDK_HOST_SYSTEM_NAME : "windows", "linux-x86" or "darwin-x86" depending on host platform
-#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86" or "mips" depending on ANDROID_ABI
-#   ANDROID_NDK_RELEASE : one of r5, r5b, r5c, r6, r6b, r7, r7b, r7c, r8, r8b, r8c, r8d, r8e, r9, r9b, r9c; set only for NDK
-#   ANDROID_ARCH_NAME : "arm" or "x86" or "mips" depending on ANDROID_ABI
+#   ANDROID_NDK_ABI_NAME : "armeabi", "armeabi-v7a", "x86", "mips", "arm64-v8a", "x86_64", "mips64" depending on ANDROID_ABI
+#   ANDROID_NDK_RELEASE : from r5 to r10d; set only for NDK
+#   ANDROID_NDK_RELEASE_NUM : numeric ANDROID_NDK_RELEASE version (1000*major+minor)
+#   ANDROID_ARCH_NAME : "arm", "x86", "mips", "arm64", "x86_64", "mips64" depending on ANDROID_ABI
 #   ANDROID_SYSROOT : path to the compiler sysroot
 #   TOOL_OS_SUFFIX : "" or ".exe" depending on host platform
 #   ANDROID_COMPILER_IS_CLANG : TRUE if clang compiler is used
@@ -1757,7 +1748,8 @@
 #   ARMEABI_NDK_NAME : superseded by ANDROID_NDK_ABI_NAME
 #
 # Secondary (less stable) read-only variables:
-#   ANDROID_COMPILER_VERSION : GCC version used
+#   ANDROID_COMPILER_VERSION : GCC version used (not Clang version)
+#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
 #   ANDROID_CXX_FLAGS : C/C++ compiler flags required by Android platform
 #   ANDROID_SUPPORTED_ABIS : list of currently allowed values for ANDROID_ABI
 #   ANDROID_TOOLCHAIN_MACHINE_NAME : "arm-linux-androideabi", "arm-eabi" or "i686-android-linux"
@@ -1768,7 +1760,6 @@
 #   ANDROID_RTTI : if rtti is enabled by the runtime
 #   ANDROID_EXCEPTIONS : if exceptions are enabled by the runtime
 #   ANDROID_GCC_TOOLCHAIN_NAME : read-only, differs from ANDROID_TOOLCHAIN_NAME only if clang is used
-#   ANDROID_CLANG_VERSION : version of clang compiler if clang is used
 #   ANDROID_LIBM_PATH : path to libm.so (set to something like $(TOP)/out/target/product/<product_name>/obj/lib/libm.so) to workaround unresolved `sincos`
 #
 # Defaults:


Fix build of buffer_file with g++ 4.3

Fix build of buffer_file with g++ 4.3

--- indra/cmake/00-Common.cmake
+++ indra/cmake/00-Common.cmake
@@ -114,7 +114,8 @@
   # widespread of them.

   if (${CXX_VERSION} MATCHES "4.3")
-    add_definitions(-Wno-deprecated -Wno-parentheses)
+    add_definitions(-Wno-parentheses)
+    set(CMAKE_CXX_FLAGS "-Wno-deprecated ${CMAKE_CXX_FLAGS}")
   endif (${CXX_VERSION} MATCHES "4.3")

   # End of hacks.


fix(docs): Add cursor options to example

--- doc/config.cmake
+++ doc/config.cmake
@@ -65,6 +65,9 @@

 ;scroll-up = i3wm-wsnext
 ;scroll-down = i3wm-wsprev
+
+cursor-click = pointer
+cursor-scroll = ns-resize

 [module/xwindow]
 type = internal/xwindow


Fixed: Issue where a CMake macro was calling return().  The macro was
redefined to be a function.

Signed-off-with-cleanup-by: gerrit <788f206ccdc6f0273070dd892b0148035dd2ebe5@vossg.org>

--- CMake/BuildFunctions.cmake
+++ CMake/BuildFunctions.cmake
@@ -2477,7 +2477,7 @@
 ##########################################################################
 # Add Tutorial builds as tests
 #
-MACRO(OSG_ADD_TUTORIAL_TESTS TUTORIALS_NAME TUTORIAL_SOURCE_DIR)
+FUNCTION(OSG_ADD_TUTORIAL_TESTS TUTORIALS_NAME TUTORIAL_SOURCE_DIR)
     IF(NOT OSGBUILD_UNITTESTS)
         RETURN()
     ENDIF()
@@ -2499,4 +2499,4 @@
         ADD_TEST(NAME "${TUTORIALS_NAME}-${TUTORIAL_NAME}"
                  COMMAND test -e ${TUTORIAL_EXE_PATH})
     ENDFOREACH()
-ENDMACRO()
+ENDFUNCTION()


[skip travis] Add $VULKAN_SDK to search path for dxc.exe

--- CMake/FindWindowsSDK.cmake
+++ CMake/FindWindowsSDK.cmake
@@ -10,6 +10,7 @@
 # The following variables can be set as arguments
 #
 #   WindowsSDK_ROOT_DIR
+#   ENV{VULKAN_SDK}
 #

 FIND_PROGRAM(
@@ -17,6 +18,7 @@
     dxc
     PATHS
         ${WindowsSDK_ROOT_DIR}
+        $ENV{VULKAN_SDK}
     PATH_SUFFIXES
         bin
 )


Add debug postfix for MSVC builds

Add debug postfix for MSVC builds

--- CMake/windows_config.cmake
+++ CMake/windows_config.cmake
@@ -8,9 +8,7 @@
     # Makes VS15 find the DLL when trying to run examples/tests
     set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
     set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-    # build with multiple cores
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
-    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+
     ## Check for Windows Version ##
     if( (${CMAKE_SYSTEM_VERSION} EQUAL 6.1) OR (FORCE_WINUSB_UVC) ) # Windows 7
         message(STATUS "Build for Win7")
@@ -26,7 +24,17 @@
         set(BACKEND RS2_USE_WINUSB_UVC_BACKEND)
     endif()

-    if (MSVC)
+    if(MSVC)
+        # Set CMAKE_DEBUG_POSTFIX to "d" to add a trailing "d" to library
+        # built in debug mode. In this Windows user can compile, build and install the
+        # library in both Release and Debug configuration avoiding naming clashes in the
+        # installation directories.
+        set(CMAKE_DEBUG_POSTFIX "d")
+
+        # build with multiple cores
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
+        set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP")
+
         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /wd4819")
         set(LRS_TRY_USE_AVX true)
         add_definitions(-D_UNICODE)


fix AddCompilerFlag and add flag to store C/CXX result in a variable

--- cmake/AddCompilerFlag.cmake
+++ cmake/AddCompilerFlag.cmake
@@ -10,7 +10,7 @@
    set(_cxx_flags "CMAKE_CXX_FLAGS")
    if(${ARGC} EQUAL 2)
       set(${ARGV1} "${check_cxx_compiler_flag_${_flag_esc}}")
-   elseif(ARGC GREATER 2)
+   elseif(${ARGC} GREATER 2)
       set(state 0)
       unset(_c_flags)
       unset(_cxx_flags)
@@ -19,10 +19,18 @@
             set(state 1)
          elseif(_arg STREQUAL "CXX_FLAGS")
             set(state 2)
+         elseif(_arg STREQUAL "C_RESULT")
+            set(state 3)
+         elseif(_arg STREQUAL "CXX_RESULT")
+            set(state 4)
          elseif(state EQUAL 1)
             set(_c_flags "${_arg}")
          elseif(state EQUAL 2)
             set(_cxx_flags "${_arg}")
+         elseif(state EQUAL 3)
+            set(${_arg} ${check_c_compiler_flag_${_flag_esc}})
+         elseif(state EQUAL 4)
+            set(${_arg} ${check_cxx_compiler_flag_${_flag_esc}})
          else()
             message(FATAL_ERROR "Syntax error for AddCompilerFlag")
          endif()


Fixed path to GDAL data directory

Fixed path to GDAL data directory

--- cmake/DevBaseExternal.cmake
+++ cmake/DevBaseExternal.cmake
@@ -149,7 +149,11 @@
         HINTS ${GDAL_INCLUDE_DIR}/../bin
     )

-    set(GDAL_DATA ${GDAL_INCLUDE_DIR}/../share/gdal)
+    if(WIN32)
+        set(GDAL_DATA ${GDAL_INCLUDE_DIR}/../share/gdal)
+    else()
+        set(GDAL_DATA ${GDAL_INCLUDE_DIR}/../../share/gdal)
+    endif()

     if(NOT EXISTS "${GDAL_DATA}")
         message(FATAL_ERROR "GDal data dir not found")


Standalone IPP with IW fix;

Standalone IPP with IW fix;

--- cmake/OpenCVFindIPPIW.cmake
+++ cmake/OpenCVFindIPPIW.cmake
@@ -31,9 +31,10 @@

 # This function detects Intel IPP IW version by analyzing .h file
 macro(ippiw_setup PATH BUILD)
-  set(FILE "${PATH}/include/iw/iw_version.h")
+  set(FILE "${PATH}/include/iw/iw_ll.h") # check if Intel IPP IW is OpenCV specific
   ippiw_debugmsg("Checking path: ${PATH}")
   if(EXISTS "${FILE}")
+    set(FILE "${PATH}/include/iw/iw_version.h")
     ippiw_debugmsg("vfile\tok")
     file(STRINGS "${FILE}" IW_VERSION_MAJOR  REGEX "IW_VERSION_MAJOR")
     file(STRINGS "${FILE}" IW_VERSION_MINOR  REGEX "IW_VERSION_MINOR")


[CMake] add_llvm_target(): No need to include TABLEGEN_OUTPUT in source list.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@202862 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -456,7 +456,7 @@
   include_directories(BEFORE
     ${CMAKE_CURRENT_BINARY_DIR}
     ${CMAKE_CURRENT_SOURCE_DIR})
-  add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
+  add_llvm_library(LLVM${target_name} ${ARGN})
   set( CURRENT_LLVM_TARGET LLVM${target_name} )
 endmacro(add_llvm_target)


Revert "Move clang feature flags settings out of LLVM core and into cfe"

This broke one of the builds, presumably side-by-side modular CMake.
Investigating.

This reverts commit r212998.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@213005 91177308-0d34-0410-b5e6-96231b3b80d8

--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -632,6 +632,22 @@
   set(HOST_OS ${CMAKE_SYSTEM_NAME})
   set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR})

+  if (CLANG_ENABLE_ARCMT)
+    set(ENABLE_CLANG_ARCMT "1")
+  else()
+    set(ENABLE_CLANG_ARCMT "0")
+  endif()
+  if (CLANG_ENABLE_REWRITER)
+    set(ENABLE_CLANG_REWRITER "1")
+  else()
+    set(ENABLE_CLANG_REWRITER "0")
+  endif()
+  if (CLANG_ENABLE_STATIC_ANALYZER)
+    set(ENABLE_CLANG_STATIC_ANALYZER "1")
+  else()
+    set(ENABLE_CLANG_STATIC_ANALYZER "0")
+  endif()
+
   configure_file(${input} ${output} @ONLY)
 endfunction()


Update FindICU.cmake

Update FindICU.cmake

--- cmake_modules/FindICU.cmake
+++ cmake_modules/FindICU.cmake
@@ -1,313 +1,156 @@
-# This module can find the International Components for Unicode (ICU) Library
+# Copyright 2006-2008 The FLWOR Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# - Find the International Components for Unicode (ICU) Library
 #
-# Requirements:
-# - CMake >= 2.8.3 (for new version of find_package_handle_standard_args)
+# Once done this will define
 #
-# The following variables will be defined for your use:
-#   - ICU_FOUND             : were all of your specified components found (include dependencies)?
-#   - ICU_INCLUDE_DIRS      : ICU include directory
-#   - ICU_LIBRARIES         : ICU libraries
-#   - ICU_VERSION           : complete version of ICU (x.y.z)
-#   - ICU_MAJOR_VERSION     : major version of ICU
-#   - ICU_MINOR_VERSION     : minor version of ICU
-#   - ICU_PATCH_VERSION     : patch version of ICU
-#   - ICU_<COMPONENT>_FOUND : were <COMPONENT> found? (FALSE for non specified component if it is not a dependency)
+#  ICU_FOUND          - True if ICU found.
+#  ICU_I18N_FOUND     - True if ICU's internationalization library found.
+#  ICU_DATA_FOUND     - True if ICU data library found.
 #
-# For windows or non standard installation, define ICU_ROOT variable to point to the root installation of ICU. Two ways:
-#   - run cmake with -DICU_ROOT=<PATH>
-#   - define an environment variable with the same name before running cmake
-# With cmake-gui, before pressing "Configure":
-#   1) Press "Add Entry" button
-#   2) Add a new entry defined as:
-#     - Name: ICU_ROOT
-#     - Type: choose PATH in the selection list
-#     - Press "..." button and select the root installation of ICU
+#  ICU_INCLUDE_DIRS   - Directory to include to get ICU headers
+#                       Note: always include ICU headers as, e.g.,
+#                       unicode/utypes.h
+#  ICU_LIBRARIES      - Libraries to link against for the common ICU
+#  ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
+#                       (note: in addition to ICU_LIBRARIES)
+#  ICU_DATA_LIBRARIES - Libraries to link against for ICU data
 #
-# Example Usage:
+#  ICU_VERSION        - ICU's version number.
 #
-#   1. Copy this file in the root of your project source directory
-#   2. Then, tell CMake to search this non-standard module in your project directory by adding to your CMakeLists.txt:
-#     set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
-#   3. Finally call find_package() once, here are some examples to pick from
-#
-#   Require ICU 4.4 or later
-#     find_package(ICU 4.4 REQUIRED)
-#
-#   if(ICU_FOUND)
-#      include_directories(${ICU_INCLUDE_DIRS})
-#      add_executable(myapp myapp.c)
-#      target_link_libraries(myapp ${ICU_LIBRARIES})
-#   endif(ICU_FOUND)

-#=============================================================================
-# Copyright (c) 2011-2013, julp
-#
-# Distributed under the OSI-approved BSD License
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-#=============================================================================
+# Look for the header file.
+find_path(
+  ICU_INCLUDE
+  NAMES unicode/utypes.h
+  PATHS ${ICU_INCLUDE_DIR}
+  DOC "Include directory for the ICU library")
+mark_as_advanced(ICU_INCLUDE)

-find_package(PkgConfig QUIET)
+# Look for the library.
+find_library(
+  ICU_LIBRARY
+  NAMES icuuc cygicuuc cygicuuc32 cygicuuc38
+  PATHS ${ICU_LIBRARY_DIR}
+  DOC "Libraries to link against for the common parts of ICU (icuuc, cygicuuc, cygicuuc32 or cygicuuc38)")
+mark_as_advanced(ICU_LIBRARY)

-########## Private ##########
-if(NOT DEFINED ICU_PUBLIC_VAR_NS)
-    set(ICU_PUBLIC_VAR_NS "ICU")                          # Prefix for all ICU relative public variables
-endif(NOT DEFINED ICU_PUBLIC_VAR_NS)
-if(NOT DEFINED ICU_PRIVATE_VAR_NS)
-    set(ICU_PRIVATE_VAR_NS "_${ICU_PUBLIC_VAR_NS}")       # Prefix for all ICU relative internal variables
-endif(NOT DEFINED ICU_PRIVATE_VAR_NS)
-if(NOT DEFINED PC_ICU_PRIVATE_VAR_NS)
-    set(PC_ICU_PRIVATE_VAR_NS "_PC${ICU_PRIVATE_VAR_NS}") # Prefix for all pkg-config relative internal variables
-endif(NOT DEFINED PC_ICU_PRIVATE_VAR_NS)
+if (ICU_LIBRARY)
+  MESSAGE(STATUS "Found ICU library -- " ${ICU_LIBRARY})
+else (ICU_LIBRARY)
+  MESSAGE(STATUS "Could not find ICU library")
+endif (ICU_LIBRARY)

-function(icudebug _VARNAME)
-    if(${ICU_PUBLIC_VAR_NS}_DEBUG)
-        if(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
-            message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = ${${ICU_PUBLIC_VAR_NS}_${_VARNAME}}")
-        else(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
-            message("${ICU_PUBLIC_VAR_NS}_${_VARNAME} = <UNDEFINED>")
-        endif(DEFINED ${ICU_PUBLIC_VAR_NS}_${_VARNAME})
-    endif(${ICU_PUBLIC_VAR_NS}_DEBUG)
-endfunction(icudebug)
+# Discover the version.
+IF (NOT ICU_INCLUDE STREQUAL "")
+  # ICU 3.x has the relevant #defines in uversion.h; 4.x uses uvernum.h.
+  FIND_PATH(ICUVERHPPPATH NAMES unicode/uvernum.h unicode/uversion.h
+    PATHS ${ICU_INCLUDE} NO_DEFAULT_PATH)

-set(${ICU_PRIVATE_VAR_NS}_ROOT "")
-if(DEFINED ENV{ICU_ROOT})
-    set(${ICU_PRIVATE_VAR_NS}_ROOT "$ENV{ICU_ROOT}")
-endif(DEFINED ENV{ICU_ROOT})
-if (DEFINED ICU_ROOT)
-    set(${ICU_PRIVATE_VAR_NS}_ROOT "${ICU_ROOT}")
-endif(DEFINED ICU_ROOT)
+  IF ( ${ICUVERHPPPATH} STREQUAL ICUVERHPPPATH-NOTFOUND )
+    SET(ICU_VERSION "0")
+    MESSAGE(STATUS "Found ICU but unable to determine version - assuming version 0")
+  ELSE( ${ICUVERHPPPATH} STREQUAL ICUVERHPPPATH-NOTFOUND )
+    SET (ICUVERHPP)
+    # One of these files has to exist, or else ICUVERHPPPATH wouldn't be set.
+    # If uvernum.h exists, it has the data we want; otherwise, that data is
+    # in uversion.h.
+    FOREACH (header uvernum.h uversion.h)
+      SET (headerfile "${ICUVERHPPPATH}/unicode/${header}")
+      IF (EXISTS "${headerfile}")
+	FILE(READ "${headerfile}" ICUVERHPP)
+	BREAK()
+      ENDIF (EXISTS "${headerfile}")
+    ENDFOREACH (header)

-set(${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES )
-set(${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES )
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-    list(APPEND ${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin64")
-    list(APPEND ${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib64")
-endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-list(APPEND ${ICU_PRIVATE_VAR_NS}_BIN_SUFFIXES "bin")
-list(APPEND ${ICU_PRIVATE_VAR_NS}_LIB_SUFFIXES "lib")
+    STRING(REGEX MATCH "\n *#define U_ICU_VERSION_MAJOR_NUM +[0-9]+" ICUVERMAJ
+      ${ICUVERHPP})
+    STRING(REGEX MATCH "\n *#define U_ICU_VERSION_MINOR_NUM +[0-9]+" ICUVERMIN
+      ${ICUVERHPP})
+    STRING(REGEX
+      MATCH "\n *#define U_ICU_VERSION_PATCHLEVEL_NUM +[0-9]+" ICUVERPATCH
+      ${ICUVERHPP})
+
+    STRING(REGEX REPLACE "\n *#define U_ICU_VERSION_MAJOR_NUM +" ""
+      ICUVERMAJ ${ICUVERMAJ})
+    STRING(REGEX REPLACE "\n *#define U_ICU_VERSION_MINOR_NUM +" ""
+      ICUVERMIN ${ICUVERMIN})
+    STRING(REGEX REPLACE "\n *#define U_ICU_VERSION_PATCHLEVEL_NUM +" ""
+      ICUVERPATCH ${ICUVERPATCH})
+
+    SET(ICU_VERSION ${ICUVERMAJ}.${ICUVERMIN}.${ICUVERPATCH})
+    MESSAGE(STATUS "ICU Version: ${ICU_VERSION}")
+
+  ENDIF ( ${ICUVERHPPPATH} STREQUAL ICUVERHPPPATH-NOTFOUND )
+ENDIF (NOT ICU_INCLUDE STREQUAL "")

-set(${ICU_PRIVATE_VAR_NS}_COMPONENTS )
-# <icu component name> <library name 1> ... <library name N>
-macro(icu_declare_component _NAME)
-    list(APPEND ${ICU_PRIVATE_VAR_NS}_COMPONENTS ${_NAME})
-    set("${ICU_PRIVATE_VAR_NS}_COMPONENTS_${_NAME}" ${ARGN})
-endmacro(icu_declare_component)

-icu_declare_component(data icudata)
-icu_declare_component(uc   icuuc)         # Common and Data libraries
-icu_declare_component(i18n icui18n icuin) # Internationalization library
-icu_declare_component(io   icuio ustdio)  # Stream and I/O Library
-icu_declare_component(le   icule)         # Layout library
-icu_declare_component(lx   iculx)         # Paragraph Layout library
+# Copy the results to the output variables.
+if(ICU_INCLUDE AND ICU_LIBRARY)
+  set(ICU_FOUND 1)
+  set(ICU_LIBRARIES ${ICU_LIBRARY})
+  set(ICU_INCLUDE_DIRS ${ICU_INCLUDE})

-########## Public ##########
-set(${ICU_PUBLIC_VAR_NS}_FOUND TRUE)
-set(${ICU_PUBLIC_VAR_NS}_LIBRARIES )
-set(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS )
-set(${ICU_PUBLIC_VAR_NS}_C_FLAGS "")
-set(${ICU_PUBLIC_VAR_NS}_CXX_FLAGS "")
-set(${ICU_PUBLIC_VAR_NS}_CPP_FLAGS "")
-set(${ICU_PUBLIC_VAR_NS}_C_SHARED_FLAGS "")
-set(${ICU_PUBLIC_VAR_NS}_CXX_SHARED_FLAGS "")
-set(${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS "")
-foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PRIVATE_VAR_NS}_COMPONENTS})
-    string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT)
-    set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE) # may be done in the icu_declare_component macro
-endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
+  # Look for the ICU internationalization libraries
+  find_library(
+    ICU_I18N_LIBRARY
+    NAMES icuin icui18n cygicuin cygicuin32 cygicuin38
+    PATHS ${ICU_LIBRARY_DIR}
+    DOC "Libraries to link against for ICU internationalization (icuin, icui18n, cygicuin, cygicuin32 or cygicuin38)")
+  mark_as_advanced(ICU_I18N_LIBRARY)
+  if (ICU_I18N_LIBRARY)
+    MESSAGE(STATUS "Found ICU internationalization library -- " ${ICU_I18N_LIBRARY})
+    set(ICU_I18N_FOUND 1)
+    set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
+  else (ICU_I18N_LIBRARY)
+    MESSAGE(STATUS "Could not find ICU internationalization library")
+    set(ICU_I18N_FOUND 0)
+    set(ICU_I18N_LIBRARIES)
+  endif (ICU_I18N_LIBRARY)

-# Check components
-if(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS) # uc required at least
-    set(${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc)
-else(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
-    list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS uc)
-    list(REMOVE_DUPLICATES ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
-    foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
-        if(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
-            message(FATAL_ERROR "Unknown ICU component: ${${ICU_PRIVATE_VAR_NS}_COMPONENT}")
-        endif(NOT DEFINED ${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
-    endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
-endif(NOT ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
+  # On cygwin, the data library is called icudt
+  if (CYGWIN OR MSVC)
+    SET (ICU_DATA_NAMES icudt cygicudt cygicudt38)
+  else (CYGWIN OR MSVC)
+    SET (ICU_DATA_NAMES icudata)
+  endif (CYGWIN OR MSVC)

-# Includes
-find_path(
-    ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
-    NAMES unicode/utypes.h utypes.h
-    HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
-    PATH_SUFFIXES "include"
-    DOC "Include directories for ICU"
-)
-
-if(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
-    ########## <part to keep synced with tests/version/CMakeLists.txt> ##########
-    if(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uvernum.h") # ICU >= 4
-        file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uvernum.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
-    elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uversion.h") # ICU [2;4[
-        file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/uversion.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
-    elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/utypes.h") # ICU [1.4;2[
-        file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/unicode/utypes.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
-    elseif(EXISTS "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h") # ICU 1.3
-        file(READ "${${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS}/utypes.h" ${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS)
-    else()
-        message(FATAL_ERROR "ICU version header not found")
-    endif()
-
-    if(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *ICU_VERSION *\"([0-9]+)\".*") # ICU 1.3
-        # [1.3;1.4[ as #define ICU_VERSION "3" (no patch version, ie all 1.3.X versions will be detected as 1.3.0)
-        set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "1")
-        set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_1}")
-        set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "0")
-    elseif(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *U_ICU_VERSION_MAJOR_NUM *([0-9]+).*")
-        #
-        # Since version 4.9.1, ICU release version numbering was totaly changed, see:
-        # - http://site.icu-project.org/download/49
-        # - http://userguide.icu-project.org/design#TOC-Version-Numbers-in-ICU
-        #
-        set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
-        string(REGEX REPLACE ".*# *define *U_ICU_VERSION_MINOR_NUM *([0-9]+).*" "\\1" ${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS}")
-        string(REGEX REPLACE ".*# *define *U_ICU_VERSION_PATCHLEVEL_NUM *([0-9]+).*" "\\1" ${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "${${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS}")
-    elseif(${ICU_PRIVATE_VAR_NS}_VERSION_HEADER_CONTENTS MATCHES ".*# *define *U_ICU_VERSION *\"(([0-9]+)(\\.[0-9]+)*)\".*") # ICU [1.4;1.8[
-        # [1.4;1.8[ as #define U_ICU_VERSION "1.4.1.2" but it seems that some 1.4.1(?:\.\d)? have releasing error and appears as 1.4.0
-        set(${ICU_PRIVATE_VAR_NS}_FULL_VERSION "${CMAKE_MATCH_1}") # copy CMAKE_MATCH_1, no longer valid on the following if
-        if(${ICU_PRIVATE_VAR_NS}_FULL_VERSION MATCHES "^([0-9]+)\\.([0-9]+)$")
-            set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
-            set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}")
-            set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "0")
-        elseif(${ICU_PRIVATE_VAR_NS}_FULL_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)")
-            set(${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION "${CMAKE_MATCH_1}")
-            set(${ICU_PUBLIC_VAR_NS}_MINOR_VERSION "${CMAKE_MATCH_2}")
-            set(${ICU_PUBLIC_VAR_NS}_PATCH_VERSION "${CMAKE_MATCH_3}")
-        endif()
-    else()
-        message(FATAL_ERROR "failed to detect ICU version")
-    endif()
-    set(${ICU_PUBLIC_VAR_NS}_VERSION "${${ICU_PUBLIC_VAR_NS}_MAJOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_MINOR_VERSION}.${${ICU_PUBLIC_VAR_NS}_PATCH_VERSION}")
-    ########## </part to keep synced with tests/version/CMakeLists.txt> ##########
-
-    # Check dependencies (implies pkg-config)
-    if(PKG_CONFIG_FOUND)
-        set(${ICU_PRIVATE_VAR_NS}_COMPONENTS_DUP ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
-        foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PRIVATE_VAR_NS}_COMPONENTS_DUP})
-            pkg_check_modules(PC_ICU_PRIVATE_VAR_NS "icu-${${ICU_PRIVATE_VAR_NS}_COMPONENT}" QUIET)
-
-            if(${PC_ICU_PRIVATE_VAR_NS}_FOUND)
-                foreach(${PC_ICU_PRIVATE_VAR_NS}_LIBRARY ${PC_ICU_LIBRARIES})
-                    string(REGEX REPLACE "^icu" "" ${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY ${${PC_ICU_PRIVATE_VAR_NS}_LIBRARY})
-                    list(APPEND ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS ${${PC_ICU_PRIVATE_VAR_NS}_STRIPPED_LIBRARY})
-                endforeach(${PC_ICU_PRIVATE_VAR_NS}_LIBRARY)
-            endif(${PC_ICU_PRIVATE_VAR_NS}_FOUND)
-        endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
-        list(REMOVE_DUPLICATES ${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS)
-    endif(PKG_CONFIG_FOUND)
-
-    # Check libraries
-    foreach(${ICU_PRIVATE_VAR_NS}_COMPONENT ${${ICU_PUBLIC_VAR_NS}_FIND_COMPONENTS})
-        set(${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES )
-        set(${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES )
-        foreach(${ICU_PRIVATE_VAR_NS}_BASE_NAME ${${ICU_PRIVATE_VAR_NS}_COMPONENTS_${${ICU_PRIVATE_VAR_NS}_COMPONENT}})
-            list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}")
-            list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}d")
-            list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${ICU_MAJOR_VERSION}${ICU_MINOR_VERSION}")
-            list(APPEND ${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES "${${ICU_PRIVATE_VAR_NS}_BASE_NAME}${ICU_MAJOR_VERSION}${ICU_MINOR_VERSION}d")
-        endforeach(${ICU_PRIVATE_VAR_NS}_BASE_NAME)
-
-        find_library(
-            ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
-            NAMES ${${ICU_PRIVATE_VAR_NS}_POSSIBLE_RELEASE_NAMES}
-            HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
-            PATH_SUFFIXES ${_ICU_LIB_SUFFIXES}
-            DOC "Release libraries for ICU"
-        )
-        find_library(
-            ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
-            NAMES ${${ICU_PRIVATE_VAR_NS}_POSSIBLE_DEBUG_NAMES}
-            HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT}
-            PATH_SUFFIXES ${_ICU_LIB_SUFFIXES}
-            DOC "Debug libraries for ICU"
-        )
-
-        string(TOUPPER "${${ICU_PRIVATE_VAR_NS}_COMPONENT}" ${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT)
-        if(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # both not found
-            set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" FALSE)
-            set("${ICU_PUBLIC_VAR_NS}_FOUND" FALSE)
-        else(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # one or both found
-            set("${ICU_PUBLIC_VAR_NS}_${${ICU_PRIVATE_VAR_NS}_UPPER_COMPONENT}_FOUND" TRUE)
-            if(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # release not found => we are in debug
-                set(${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT} "${${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}")
-            elseif(NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}) # debug not found => we are in release
-                set(${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT} "${${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}")
-            else() # both found
-                set(
-                    ${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT}
-                    optimized ${${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}
-                    debug ${${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT}}
-                )
-            endif()
-            list(APPEND ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${${ICU_PRIVATE_VAR_NS}_LIB_${${ICU_PRIVATE_VAR_NS}_COMPONENT}})
-        endif(NOT ${ICU_PRIVATE_VAR_NS}_LIB_RELEASE_${${ICU_PRIVATE_VAR_NS}_COMPONENT} AND NOT ${ICU_PRIVATE_VAR_NS}_LIB_DEBUG_${${ICU_PRIVATE_VAR_NS}_COMPONENT})
-    endforeach(${ICU_PRIVATE_VAR_NS}_COMPONENT)
-
-    # Try to find out compiler flags
-    find_program(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE icu-config HINTS ${${ICU_PRIVATE_VAR_NS}_ROOT})
-    if(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE)
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_C_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cxxflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CXX_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cppflags OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CPP_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_C_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cxxflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CXX_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-        execute_process(COMMAND ${${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE} --cppflags-dynamic OUTPUT_VARIABLE ${ICU_PUBLIC_VAR_NS}_CPP_SHARED_FLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
-    endif(${ICU_PUBLIC_VAR_NS}_CONFIG_EXECUTABLE)
-
-    # Check find_package arguments
-    include(FindPackageHandleStandardArgs)
-    if(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
-        find_package_handle_standard_args(
-            ${ICU_PUBLIC_VAR_NS}
-            REQUIRED_VARS ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
-            VERSION_VAR ${ICU_PUBLIC_VAR_NS}_VERSION
-        )
-    else(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
-        find_package_handle_standard_args(${ICU_PUBLIC_VAR_NS} "ICU not found" ${ICU_PUBLIC_VAR_NS}_LIBRARIES ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
-    endif(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
-else(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
-    if(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
-        message(FATAL_ERROR "Could not find ICU include directory")
-    endif(${ICU_PUBLIC_VAR_NS}_FIND_REQUIRED AND NOT ${ICU_PUBLIC_VAR_NS}_FIND_QUIETLY)
-endif(${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS)
-
-mark_as_advanced(
-    ${ICU_PUBLIC_VAR_NS}_INCLUDE_DIRS
-    ${ICU_PUBLIC_VAR_NS}_LIBRARIES
-)
-
-# IN (args)
-icudebug("FIND_COMPONENTS")
-icudebug("FIND_REQUIRED")
-icudebug("FIND_QUIETLY")
-icudebug("FIND_VERSION")
-# OUT
-# Found
-icudebug("FOUND")
-icudebug("UC_FOUND")
-icudebug("I18N_FOUND")
-icudebug("IO_FOUND")
-icudebug("LE_FOUND")
-icudebug("LX_FOUND")
-icudebug("DATA_FOUND")
-# Flags
-icudebug("C_FLAGS")
-icudebug("CPP_FLAGS")
-icudebug("CXX_FLAGS")
-icudebug("C_SHARED_FLAGS")
-icudebug("CPP_SHARED_FLAGS")
-icudebug("CXX_SHARED_FLAGS")
-# Linking
-icudebug("INCLUDE_DIRS")
-icudebug("LIBRARIES")
-# Version
-icudebug("MAJOR_VERSION")
-icudebug("MINOR_VERSION")
-icudebug("PATCH_VERSION")
-icudebug("VERSION")
+  # Look for ICU data library
+  find_library(
+    ICU_DATA_LIBRARY
+    NAMES ${ICU_DATA_NAMES}
+    PATHS ${ICU_LIBRARY_DIR}
+    DOC "icudata library (icudt, cygicudt or cygicudt38)")
+  mark_as_advanced(ICU_DATA_LIBRARY)
+  if (ICU_DATA_LIBRARY)
+    MESSAGE(STATUS "Found ICU data library -- " ${ICU_DATA_LIBRARY})
+    SET(ICU_DATA_FOUND 1)
+    SET(ICU_DATA_LIBRARIES ${ICU_DATA_LIBRARY})
+  else (ICU_DATA_LIBRARY)
+    MESSAGE(STATUS "Could not find ICU data library")
+    SET(ICU_DATA_FOUND 0)
+    SET(ICU_DATA_LIBRARIES)
+  endif (ICU_DATA_LIBRARY)
+
+else(ICU_INCLUDE AND ICU_LIBRARY)
+  set(ICU_FOUND 0)
+  set(ICU_I18N_FOUND 0)
+  set(ICU_DATA_FOUND 0)
+  set(ICU_LIBRARIES)
+  set(ICU_I18N_LIBRARIES)
+  set(ICU_DATA_LIBRARIES)
+  set(ICU_INCLUDE_DIRS)
+  set(ICU_VERSION 0)
+endif(ICU_INCLUDE AND ICU_LIBRARY)