summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeFindJavaCommon.cmake41
-rw-r--r--Modules/CMakePackageConfigHelpers.cmake5
-rw-r--r--Modules/FindCUDA.cmake165
-rw-r--r--Modules/FindJNI.cmake132
-rw-r--r--Modules/FindJava.cmake15
-rw-r--r--Modules/FindQt4.cmake81
-rw-r--r--Modules/WriteBasicConfigVersionFile.cmake8
7 files changed, 155 insertions, 292 deletions
diff --git a/Modules/CMakeFindJavaCommon.cmake b/Modules/CMakeFindJavaCommon.cmake
new file mode 100644
index 0000000..fcf0389
--- /dev/null
+++ b/Modules/CMakeFindJavaCommon.cmake
@@ -0,0 +1,41 @@
+
+#=============================================================================
+# Copyright 2013-2014 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Do not include this module directly from code outside CMake!
+set(_JAVA_HOME "")
+if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}")
+ set(_JAVA_HOME "${JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 1)
+else()
+ set(_ENV_JAVA_HOME "")
+ if(DEFINED ENV{JAVA_HOME})
+ file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME)
+ endif()
+ if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}")
+ set(_JAVA_HOME "${_ENV_JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 1)
+ else()
+ set(_CMD_JAVA_HOME "")
+ if(APPLE AND EXISTS /usr/libexec/java_home)
+ execute_process(COMMAND /usr/libexec/java_home
+ OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE)
+ endif()
+ if(_CMD_JAVA_HOME AND IS_DIRECTORY "${_CMD_JAVA_HOME}")
+ set(_JAVA_HOME "${_CMD_JAVA_HOME}")
+ set(_JAVA_HOME_EXPLICIT 0)
+ endif()
+ unset(_CMD_JAVA_HOME)
+ endif()
+ unset(_ENV_JAVA_HOME)
+endif()
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index f388fe0..473bbe5 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -99,7 +99,7 @@
#
# ::
#
-# WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
+# WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
#
#
#
@@ -112,6 +112,9 @@
# filename is the output filename, it should be in the build tree.
# major.minor.patch is the version number of the project to be installed
#
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable
+# is used. If this hasn't been set, it errors out.
+#
# The COMPATIBILITY mode AnyNewerVersion means that the installed
# package version will be considered compatible if it is newer or
# exactly the same as the requested version. This mode should be used
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 05f38eb..7bc8d49 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -32,9 +32,7 @@
# script (in alphebetical order). Note that any of these flags can be
# changed multiple times in the same directory before calling
# CUDA_ADD_EXECUTABLE, CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX
-# or CUDA_WRAP_SRCS.
-#
-# ::
+# or CUDA_WRAP_SRCS::
#
# CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
@@ -43,19 +41,11 @@
# nvcc in the generated source. If you compile to PTX and then load the
# file yourself, you can mix bit sizes between device and host.
#
-#
-#
-# ::
-#
# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
# -- Set to ON if you want the custom build rule to be attached to the source
# file in Visual Studio. Turn OFF if you add the same cuda file to multiple
# targets.
#
-#
-#
-# ::
-#
# This allows the user to build the target from the CUDA file; however, bad
# things can happen if the CUDA source file is added to multiple targets.
# When performing parallel builds it is possible for the custom build
@@ -68,44 +58,24 @@
# this script could detect the reuse of source files across multiple targets
# and turn the option off for the user, but no good solution could be found.
#
-#
-#
-# ::
-#
# CUDA_BUILD_CUBIN (Default OFF)
# -- Set to ON to enable and extra compilation pass with the -cubin option in
# Device mode. The output is parsed and register, shared memory usage is
# printed during build.
#
-#
-#
-# ::
-#
# CUDA_BUILD_EMULATION (Default OFF for device mode)
# -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
# when CUDA_BUILD_EMULATION is TRUE.
#
-#
-#
-# ::
-#
# CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
# -- Set to the path you wish to have the generated files placed. If it is
# blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
# Intermediate files will always be placed in
# CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
#
-#
-#
-# ::
-#
# CUDA_HOST_COMPILATION_CPP (Default ON)
# -- Set to OFF for C compilation of host code.
#
-#
-#
-# ::
-#
# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS)
# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or
# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or
@@ -113,19 +83,11 @@
# $(VCInstallDir)/bin is a special value that expands out to the path when
# the command is run from withing VS.
#
-#
-#
-# ::
-#
# CUDA_NVCC_FLAGS
# CUDA_NVCC_FLAGS_<CONFIG>
# -- Additional NVCC command line arguments. NOTE: multiple arguments must be
# semi-colon delimited (e.g. --compiler-options;-Wall)
#
-#
-#
-# ::
-#
# CUDA_PROPAGATE_HOST_FLAGS (Default ON)
# -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
# dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
@@ -137,10 +99,6 @@
# CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
# shared library compilation are not affected by this flag.
#
-#
-#
-# ::
-#
# CUDA_SEPARABLE_COMPILATION (Default OFF)
# -- If set this will enable separable compilation for all CUDA runtime object
# files. If used outside of CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY
@@ -148,38 +106,22 @@
# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME and
# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS should be called.
#
-#
-#
-# ::
-#
# CUDA_VERBOSE_BUILD (Default OFF)
# -- Set to ON to see all the commands used when building the CUDA file. When
# using a Makefile generator the value defaults to VERBOSE (run make
# VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
# always print the output.
#
-#
-#
-# The script creates the following macros (in alphebetical order):
-#
-# ::
+# The script creates the following macros (in alphebetical order)::
#
# CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
# -- Adds the cufft library to the target (can be any target). Handles whether
# you are in emulation mode or not.
#
-#
-#
-# ::
-#
# CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
# -- Adds the cublas library to the target (can be any target). Handles
# whether you are in emulation mode or not.
#
-#
-#
-# ::
-#
# CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
# [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
# -- Creates an executable "cuda_target" which is made up of the files
@@ -193,43 +135,23 @@
# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
#
-#
-#
-# ::
-#
# CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
#
-#
-#
-# ::
-#
# CUDA_BUILD_CLEAN_TARGET()
# -- Creates a convience target that deletes all the dependency files
# generated. You should make clean after running this target to ensure the
# dependency files get regenerated.
#
-#
-#
-# ::
-#
# CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
# [OPTIONS ...] )
# -- Returns a list of generated files from the input source files to be used
# with ADD_LIBRARY or ADD_EXECUTABLE.
#
-#
-#
-# ::
-#
# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
# -- Returns a list of PTX files generated from the input source files.
#
-#
-#
-# ::
-#
# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME( output_file_var
# cuda_target
# object_files )
@@ -242,10 +164,6 @@
# automatically for CUDA_ADD_LIBRARY and CUDA_ADD_EXECUTABLE. Note that
# this is a function and not a macro.
#
-#
-#
-# ::
-#
# CUDA_INCLUDE_DIRECTORIES( path0 path1 ... )
# -- Sets the directories that should be passed to nvcc
# (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu
@@ -253,17 +171,9 @@
#
#
#
-#
-#
-# ::
-#
# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS( output_file_var cuda_target
# nvcc_flags object_files)
#
-#
-#
-# ::
-#
# -- Generates the link object required by separable compilation from the given
# object files. This is called automatically for CUDA_ADD_EXECUTABLE and
# CUDA_ADD_LIBRARY, but can be called manually when using CUDA_WRAP_SRCS
@@ -273,91 +183,51 @@
# specified by CUDA_64_BIT_DEVICE_CODE. Note that this is a function
# instead of a macro.
#
-#
-#
-# ::
-#
# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
# [STATIC | SHARED | MODULE] [OPTIONS ...] )
# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
# CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
# function under the hood.
#
-#
-#
-# ::
-#
# Given the list of files (file0 file1 ... fileN) this macro generates
# custom commands that generate either PTX or linkable objects (use "PTX" or
# "OBJ" for the format argument to switch). Files that don't end with .cu
# or have the HEADER_FILE_ONLY property are ignored.
#
-#
-#
-# ::
-#
# The arguments passed in after OPTIONS are extra command line options to
# give to nvcc. You can also specify per configuration options by
# specifying the name of the configuration followed by the options. General
# options must preceed configuration specific options. Not all
# configurations need to be specified, only the ones provided will be used.
#
-#
-#
-# ::
-#
# OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
# DEBUG -g
# RELEASE --use_fast_math
# RELWITHDEBINFO --use_fast_math;-g
# MINSIZEREL --use_fast_math
#
-#
-#
-# ::
-#
# For certain configurations (namely VS generating object files with
# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
# be produced for the given cuda file. This is because when you add the
# cuda file to Visual Studio it knows that this file produces an object file
# and will link in the resulting object file automatically.
#
-#
-#
-# ::
-#
# This script will also generate a separate cmake script that is used at
# build time to invoke nvcc. This is for several reasons.
#
-#
-#
-# ::
-#
# 1. nvcc can return negative numbers as return values which confuses
# Visual Studio into thinking that the command succeeded. The script now
# checks the error codes and produces errors when there was a problem.
#
-#
-#
-# ::
-#
# 2. nvcc has been known to not delete incomplete results when it
# encounters problems. This confuses build systems into thinking the
# target was generated when in fact an unusable file exists. The script
# now deletes the output files if there was an error.
#
-#
-#
-# ::
-#
# 3. By putting all the options that affect the build into a file and then
# make the build rule dependent on the file, the output files will be
# regenerated when the options change.
#
-#
-#
-# ::
-#
# This script also looks at optional arguments STATIC, SHARED, or MODULE to
# determine when to target the object compilation for a shared library.
# BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
@@ -366,27 +236,17 @@
# <target_name>_EXPORTS is defined when a shared library compilation is
# detected.
#
-#
-#
-# ::
-#
# Flags passed into add_definitions with -D or /D are passed along to nvcc.
#
#
#
-# The script defines the following variables:
-#
-# ::
+# The script defines the following variables::
#
# CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
# CUDA_VERSION_MINOR -- The minor version.
# CUDA_VERSION
# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
#
-#
-#
-# ::
-#
# CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
# CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
# SDK. This script will not directly support finding
@@ -427,32 +287,15 @@
# Only available for CUDA version 3.2+.
# Windows only.
#
-#
-#
-#
-#
-# ::
-#
+
# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
#
-#
-#
-# ::
-#
# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
#
-#
-#
-# ::
-#
# Copyright (c) 2007-2009
# Scientific Computing and Imaging Institute, University of Utah
#
-#
-#
-# ::
-#
# This code is licensed under the MIT License. See the FindCUDA.cmake script
# for the text of the license.
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index f1cb57e..669e3e2 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -6,7 +6,10 @@
#
# This module finds if Java is installed and determines where the
# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
+# the library is. The caller may set variable JAVA_HOME to specify a
+# Java installation prefix explicitly.
+#
+# This module sets the following result variables:
#
# ::
#
@@ -91,22 +94,37 @@ macro(java_append_library_directories _var)
endforeach()
endmacro()
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+
+# Save CMAKE_FIND_FRAMEWORK
+if(DEFINED CMAKE_FIND_FRAMEWORK)
+ set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
+else()
+ unset(_JNI_CMAKE_FIND_FRAMEWORK)
+endif()
+
+if(_JAVA_HOME_EXPLICIT)
+ set(CMAKE_FIND_FRAMEWORK NEVER)
+endif()
+
+set(JAVA_AWT_LIBRARY_DIRECTORIES)
+if(_JAVA_HOME)
+ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
+ ${_JAVA_HOME}/jre/lib/{libarch}
+ ${_JAVA_HOME}/jre/lib
+ ${_JAVA_HOME}/lib
+ ${_JAVA_HOME}
+ )
+endif()
get_filename_component(java_install_version
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
-set(JAVA_AWT_LIBRARY_DIRECTORIES
+list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
)
-
-file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME)
-
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- ${_JAVA_HOME}/jre/lib/{libarch}
- ${_JAVA_HOME}/jre/lib
- ${_JAVA_HOME}/lib
- ${_JAVA_HOME}
/usr/lib
/usr/local/lib
/usr/lib/jvm/java/lib
@@ -135,20 +153,21 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
set(JAVA_JVM_LIBRARY_DIRECTORIES)
foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
- set(JAVA_JVM_LIBRARY_DIRECTORIES
- ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
"${dir}"
"${dir}/client"
"${dir}/server"
)
endforeach()
-
-set(JAVA_AWT_INCLUDE_DIRECTORIES
+set(JAVA_AWT_INCLUDE_DIRECTORIES)
+if(_JAVA_HOME)
+ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
+endif()
+list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
- ${_JAVA_HOME}/include
/usr/include
/usr/local/include
/usr/lib/java/include
@@ -173,7 +192,7 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
get_filename_component(jpath "${JAVA_PROG}" PATH)
foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
if(EXISTS ${jpath}/${JAVA_INC_PATH})
- set(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES} "${jpath}/${JAVA_INC_PATH}")
+ list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
endif()
endforeach()
foreach(JAVA_LIB_PATH
@@ -181,54 +200,55 @@ foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
../java/lib ../java/jre/lib ../java/jre/lib/i386
../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
if(EXISTS ${jpath}/${JAVA_LIB_PATH})
- set(JAVA_AWT_LIBRARY_DIRECTORIES ${JAVA_AWT_LIBRARY_DIRECTORIES} "${jpath}/${JAVA_LIB_PATH}")
+ list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
endif()
endforeach()
endforeach()
if(APPLE)
- if(EXISTS ~/Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
- endif()
- if(EXISTS /Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
- endif()
- if(EXISTS /System/Library/Frameworks/JavaVM.framework)
- set(JAVA_HAVE_FRAMEWORK 1)
+ if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
+ set(_JNI_SEARCHES FRAMEWORK)
+ elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
+ set(_JNI_SEARCHES NORMAL)
+ elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
+ set(_JNI_SEARCHES NORMAL FRAMEWORK)
+ else()
+ set(_JNI_SEARCHES FRAMEWORK NORMAL)
endif()
+ set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
+ set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
+else()
+ set(_JNI_SEARCHES NORMAL)
+endif()
- if(JAVA_HAVE_FRAMEWORK)
- if(NOT JAVA_AWT_LIBRARY)
- set (JAVA_AWT_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
- endif()
-
- if(NOT JAVA_JVM_LIBRARY)
- set (JAVA_JVM_LIBRARY "-framework JavaVM" CACHE FILEPATH "Java Frameworks" FORCE)
- endif()
+set(_JNI_NORMAL_JVM
+ NAMES jvm
+ PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
+ )
- if(NOT JAVA_AWT_INCLUDE_PATH)
- if(EXISTS /System/Library/Frameworks/JavaVM.framework/Headers/jawt.h)
- set (JAVA_AWT_INCLUDE_PATH "/System/Library/Frameworks/JavaVM.framework/Headers" CACHE FILEPATH "jawt.h location" FORCE)
- endif()
- endif()
+set(_JNI_NORMAL_JAWT
+ NAMES jawt
+ PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
+ )
- # If using "-framework JavaVM", prefer its headers *before* the others in
- # JAVA_AWT_INCLUDE_DIRECTORIES... (*prepend* to the list here)
- #
- set(JAVA_AWT_INCLUDE_DIRECTORIES
- ~/Library/Frameworks/JavaVM.framework/Headers
- /Library/Frameworks/JavaVM.framework/Headers
- /System/Library/Frameworks/JavaVM.framework/Headers
- ${JAVA_AWT_INCLUDE_DIRECTORIES}
- )
+foreach(search ${_JNI_SEARCHES})
+ find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
+ find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
+ if(JAVA_JVM_LIBRARY)
+ break()
endif()
+endforeach()
+unset(_JNI_SEARCHES)
+unset(_JNI_FRAMEWORK_JVM)
+unset(_JNI_FRAMEWORK_JAWT)
+unset(_JNI_NORMAL_JVM)
+unset(_JNI_NORMAL_JAWT)
+
+# Find headers matching the library.
+if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
+ set(CMAKE_FIND_FRAMEWORK ONLY)
else()
- find_library(JAVA_AWT_LIBRARY jawt
- PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
- )
- find_library(JAVA_JVM_LIBRARY NAMES jvm JavaVM
- PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
- )
+ set(CMAKE_FIND_FRAMEWORK NEVER)
endif()
# add in the include path
@@ -252,6 +272,14 @@ find_path(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_INCLUDE_PATH}
)
+# Restore CMAKE_FIND_FRAMEWORK
+if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
+ set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
+ unset(_JNI_CMAKE_FIND_FRAMEWORK)
+else()
+ unset(CMAKE_FIND_FRAMEWORK)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY
JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH)
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index e35fc1d..a488c46 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -5,8 +5,10 @@
# Find Java
#
# This module finds if Java is installed and determines where the
-# include files and libraries are. This code sets the following
-# variables:
+# include files and libraries are. The caller may set variable JAVA_HOME
+# to specify a Java installation prefix explicitly.
+#
+# This module sets the following result variables:
#
# ::
#
@@ -67,8 +69,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
+
# The HINTS option should only be used for values computed from the system.
-set(_JAVA_HINTS
+set(_JAVA_HINTS)
+if(_JAVA_HOME)
+ list(APPEND _JAVA_HINTS ${_JAVA_HOME}/bin)
+endif()
+list(APPEND _JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\2.0;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.9;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.8;JavaHome]/bin"
@@ -77,7 +85,6 @@ set(_JAVA_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
- $ENV{JAVA_HOME}/bin
)
# Hard-coded guesses should still go in PATHS. This ensures that the user
# environment can always override hard guesses.
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 2d2feae..9ea77d4 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -35,78 +35,7 @@
# meta-object code generation,``uic`` for widget layout and population,
# and ``rcc`` for virtual filesystem content generation. These tools may be
# automatically invoked by :manual:`cmake(1)` if the appropriate conditions
-# are met.
-#
-# The tools are executed as part of a synthesized custom target generated by
-# CMake. Target dependencies may be added to that custom target by adding them
-# to the :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property.
-#
-# AUTOMOC
-# '''''''
-#
-# The :prop_tgt:`AUTOMOC` target property controls whether :manual:`cmake(1)`
-# inspects the C++ files in the target to determine if they require ``moc`` to
-# be run, and to create rules to execute ``moc`` at the appropriate time.
-#
-# If a ``Q_OBJECT`` or ``Q_GADGET`` macro is found in a header file, ``moc``
-# will be run on the file. The result will be put into a file named according
-# to ``moc_<basename>.cpp``. If the macro is found in a C++ implementation
-# file, the moc output will be put into a file named according to
-# ``<basename>.moc``, following the Qt conventions. The ``moc file`` may be
-# included by the user in the C++ implementation file with a preprocessor
-# ``#include``. If it is not so included, it will be added to a separate file
-# which is compiled into the target.
-#
-# Generated ``moc_*.cpp`` and ``*.moc`` files are placed in the build directory
-# so it is convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR`
-# variable. The :prop_tgt:`AUTOMOC` target property may be pre-set for all
-# following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The
-# :prop_tgt:`AUTOMOC_MOC_OPTIONS` target property may be populated to set
-# options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS`
-# variable may be populated to pre-set the options for all following targets.
-#
-# AUTOUIC
-# '''''''
-#
-# The :prop_tgt:`AUTOUIC` target property controls whether :manual:`cmake(1)`
-# inspects the C++ files in the target to determine if they require ``uic`` to
-# be run, and to create rules to execute ``uic`` at the appropriate time.
-#
-# If a preprocessor ``#include`` directive is found which matches
-# ``ui_<basename>.h``, and a ``<basename>.ui`` file exists, then ``uic`` will
-# be executed to generate the appropriate file.
-#
-# Generated ``ui_*.h`` files are placed in the build directory so it is
-# convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable. The
-# :prop_tgt:`AUTOUIC` target property may be pre-set for all following targets
-# by setting the :variable:`CMAKE_AUTOUIC` variable. The
-# :prop_tgt:`AUTOUIC_OPTIONS` target property may be populated to set options
-# to pass to ``uic``. The :variable:`CMAKE_AUTOUIC_OPTIONS` variable may be
-# populated to pre-set the options for all following targets. The
-# :prop_sf:`AUTOUIC_OPTIONS` source file property may be set on the
-# ``<basename>.ui`` file to set particular options for the file. This
-# overrides options from the :prop_tgt:`AUTOUIC_OPTIONS` target property.
-#
-# AUTORCC
-# '''''''
-#
-# The :prop_tgt:`AUTORCC` target property controls whether :manual:`cmake(1)`
-# creates rules to execute ``rcc`` at the appropriate time on source files
-# which have the suffix ``.qrc``.
-#
-# .. code-block:: cmake
-#
-# add_executable(myexe main.cpp resource_file.qrc)
-#
-# The :prop_tgt:`AUTORCC` target property may be pre-set for all following targets
-# by setting the :variable:`CMAKE_AUTORCC` variable. The
-# :prop_tgt:`AUTORCC_OPTIONS` target property may be populated to set options
-# to pass to ``rcc``. The :variable:`CMAKE_AUTORCC_OPTIONS` variable may be
-# populated to pre-set the options for all following targets. The
-# :prop_sf:`AUTORCC_OPTIONS` source file property may be set on the
-# ``<name>.qrc`` file to set particular options for the file. This
-# overrides options from the :prop_tgt:`AUTORCC_OPTIONS` target property.
-#
+# are met. See :manual:`cmake-qt(7)` for more.
#
# Qt Macros
# =========
@@ -589,6 +518,14 @@ _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION)
if (QT_QMAKE_EXECUTABLE AND QTVERSION)
+ if (Qt5Core_FOUND)
+ # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
+ # path to moc. Unset that variable when Qt 4 and 5 are used together, so
+ # that when find_program looks for moc, it is not set to the Qt 5 version.
+ # If FindQt4 has already put the Qt 4 path in the cache, the unset()
+ # command 'unhides' the (correct) cache variable.
+ unset(QT_MOC_EXECUTABLE)
+ endif()
if (QT_QMAKE_EXECUTABLE_LAST)
string(COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED)
endif()
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 95187b4..7d28e95 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -6,7 +6,7 @@
#
# ::
#
-# WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+# WRITE_BASIC_CONFIG_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
#
#
#
@@ -46,7 +46,11 @@ function(WRITE_BASIC_CONFIG_VERSION_FILE _filename)
endif()
if("${CVF_VERSION}" STREQUAL "")
- message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ if ("${PROJECT_VERSION}" STREQUAL "")
+ message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
+ else()
+ set(CVF_VERSION "${PROJECT_VERSION}")
+ endif()
endif()
configure_file("${versionTemplateFile}" "${_filename}" @ONLY)