diff options
26 files changed, 1565 insertions, 182 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 93822ef..cf948c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,7 +416,7 @@ ENDIF() # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) -SET(CMake_VERSION_PATCH 4) +SET(CMake_VERSION_PATCH 5) #SET(CMake_VERSION_TWEAK 0) #SET(CMake_VERSION_RC 1) diff --git a/ChangeLog.manual b/ChangeLog.manual index 20998a3..a00ce00 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,426 @@ +Changes in CMake 2.8.5 (since 2.8.5-rc3) +-------------------------------------------- +Brad King (1): + Revert "Add a new function SWIG_GET_WRAPPER_DEPENDENCIES to UseSWIG.cmake" + (this revert means that issue #4147 has been re-opened) + +Changes in CMake 2.8.5-rc3 (since 2.8.5-rc2) +-------------------------------------------- +Bill Hoffman (4): + Use devenv instead of msbuild for vs2010. + Revert "With very long file names, VS 2010 was unable to compile files." + Use relative paths for custom command inputs. + Look for VCExpress as a possible build tool as well as devenv. + +Brad King (3): + KWSys: Recognize color TERM=screen-256color-bce (#12287) + find_library: Use lib->lib64 conversion in CXX-only projects (#12247,#12248) + libarchive: Install COPYING with CMake documentation + +Christoph Höger (1): + FindJNI: Search in Fedora arch-specific JVM location (#12276) + +Julien Malik (1): + FindSWIG: Use NAMES in find_program directives (#12280) + +Modestas Vainius (1): + Documentation: Fix spelling / formatting errors (#12287) + +Philip Lowman (3): + FindBoost: Fixes #12188 + FindBoost: Also search for 1.46.1 + Detect VS 2010 SP1, faster and more robust detection + +Changes in CMake 2.8.5-rc2 (since 2.8.5-rc1) +-------------------------------------------- +Bill Hoffman (6): + Fix a memory leak. + Fix for bug#10798. VS10 did not append -I flags with COMPILE_FLAGS prop. + Append and do not clobber CMAKE_CXX_FLAGS in the test. + Use bin tree for inclues to avoid -I with spaces in the path. + One more try. Use full path by default, and relative on broken compilers. + Fix for bug #11927, external project git clone step always runs vs10. + +Brad King (9): + XL: Place Fortran modules with -qmoddir= flag (#12246) + Teach file(DOWNLOAD|UPLOAD) to timeout after inactivity + Xcode: Fix parallel build depends with universal binaries (#11844) + Fix style errors added by parent and grandparent + Use cascading-if for per-config test and install code + CTest: Report tests not run due to unknown configuration + GNU: Fix CMAKE_INCLUDE_SYSTEM_FLAG_<lang> value (#12258) + Teach find_(library|package) about Linux multiarch (#12037) + Test find_package multiarch support (#12037) + +Clinton Stimpson (11): + BundleUtilities: Work w/ non .app exes on Mac (#12034) + BundleUtilities: Fix regex to extract dependents from ldd (#12034) + BundleUtilities: Fix test when using xcode (#12034) + BundleUtilities: Fix issues with custom target DEPENDS in test (#12034) + BundleUtilities: Disable running test on Windows unless using MSVC. + BundleUtilities: Run test on Windows if either MSVC or dumpbin was found. + BundleUtilities: Print reason for not loading module.so + BundleUtilities: Add rpath to loadable modules in test. + Revert "BundleUtilities: Run test on Windows if either MSVC or dumpbin was found." + Qt4: complete module dependencies in UseQt4.cmake + Add imported targets support for frameworks on Mac. + +Daniel R. Gomez (1): + Fix plugin API for gcc 2.9-aix51-020209 (#12233) + +David Cole (3): + BundleUtilities: Avoid a cryptic and unhelpful error message + BundleUtilities: Avoid test on Watcom dashboards (#12034) + CMake: eliminate use of cvs in the Release scripts + +Eric NOULARD (2): + CPackRPM: Enhance documentation + Add some more Specs file tag handling. + +Johan Björk (3): + CMake: Move tokenize to cmSystemTools + Xcode: Support multiple level nesting of XCode folders (#10039) + XCode: Support target folders on XCode. + +Modestas Vainius (1): + multiarch: Set CMAKE_LIBRARY_ARCHITECTURE_REGEX for Linux|Hurd|kFreeBSD + +Philip Lowman (3): + FindProtobuf: Better MSVC support, Searching for protobuf lite + Fix , to - in Copyright message so it passes CMake.ModuleNotices test + 10997: PROTOBUF_GENERATE_CPP now supports proto files outside current dir + +Rolf Eike Beer (1): + CMake: Update documentation of STRING(SUBSTRING) for length -1 (#10740) + +Sean McBride (1): + Fix XCode -> Xcode typos, notably in man page (#12231) + +Tim Gallagher (1): + Modified the FindHDF5.cmake file to locate the Fortran bindings. + +Will Dicharry (7): + HDF5 high level library is a find COMPONENT now. + Add logic for CMake built HDF5 install. + Use CMAKE_CURRENT_LIST_DIR to locate FindPackageHandleStandardArgs. + Use HDF5_FOUND to control autoconf and CMake built FindHDF5. + Fix for bug 11752, mixed debug and release libraries. + FindHDF5 ensures good link lines when libraries are duplicated. + Remove unnecessary mark_as_advanced from FindHDF5. + +Zach Mullen (3): + Dynamic analysis test output should not be compressed. + We will actually compress memcheck output if the server supports it. + Fix type conversion warning + +Changes in CMake 2.8.5-rc1 (since 2.8.4) +---------------------------------------- +Alex Neundorf (33): + Rework the way assembler is handled, use the C/CXX compiler by default + Make it possible to exlude external libs from dot files + GRAPHVIZ_IGNORE_TARGETS is now a list of regular expressions + Also generate dependers-graphviz files. + Fix XML escaping for the project() name in Eclipse projects (#11658) + Fix XML escaping for target names in Eclipse project files (#11658) + Add XML escaping for directory name in Eclipse projects (#11658) + Eclipse projects: created one linked resource for each subproject + Also add the SOURCES from add_custom_target() to CodeBlocks projects (#11736) + Add ASM support for the Intel compiler + Actually use CMAKE_ASM_COMPILER for asm, instead of CMAKE_C_COMPILER + Add support for ASM for the SunPro compiler + Add suport for ASM for the IBM XL compiler + Add support for ASm for the HP compiler. + Set the HP asm file suffix + Change the default rules so they fit better to the new ASM handling + Fix the default CMAKE_ASM_COMPILE_OBJECT, make XL-ASM use it + Add assemble- and preprocess commands for HP + The Assembler test now tests ASM for GNU, Intel, HP, XL and SunPro + Use a regexp instead a lot of ORs for checking the compiler ID + Only try assembler support for Makefile-based generators + Fix bad comparison in the detect assembler-code + It's ELSEIF(), not ELSIF() + Add temporary debug output for compiler ID detection for ASM + Add more regex for gcc, always print the ASM compiler ID + Add support for the Intel compiler used for ASM under Windows + -use CMAKE_C_FLAGS when generating the assembler file + -only enable the asm test for the Intel compiler if we are under UNIX + Remove trailing whitespace + Make use_mangled_mesa() available in cmake script mode (#11926) + Fix parsing include dirs and builtin macros for CXX-only projects + Don't skip the last builtin include dir for the Eclipse project file + -fix VirtualFolders in Eclipse under Windows + +Alexey Ozeritsky (1): + ACML search improvement + +Andreas Schneider (6): + Modules: Added CheckPrototypeDefinition module. + Tests: Added test for check_prototype_definition. + FindOpenSSL: Added support for pkg-config. + FindOpenSSL: We should only use hints to find OpenSSL. + FindOpenSSL: Fixed crypto und ssl variable names. + FindOpenSSL: Use find_package_handle_standard_args for version check. + +Bill Hoffman (2): + With very long file names, VS 2010 was unable to compile files. + Fix for bug where VS2010 did not use .obj files as part of the build. + +Brad King (94): + Reject directory names containing '=' (#11689) + FindQt4: Include builtin FindPackageHandleStandardArgs directly + Handle trailing slashes on add_custom_command DEPENDS + Handle relative WORKING_DIRECTORY in add_custom_(command|target) + Pass -o after -c for Fortran to avoid mpif77 ordering bug + Add link flag table entries for VS 7,8,9 + VS: Create a Fortran DLL's import library directory + Fix linker flag initialization from LDFLAGS (#11840) + ccmake: Remove extra parens around comparison + Avoid direct use of std::stringstream + Honor module .def files with MinGW tools (#9997) + CTest: Update Git submodules with --recursive + libarchive: Remove unused build/windows directory (#11885) + Pass .def files directly to MinGW tools (#9997) + Fix Fortran test .def file symbol mangling + Require at least CMake 2.6.3 to build current CMake + GNUInstallDirs: Simplify and clarify documentation + KWSys: Require at least CMake 2.6.3 + Remove unused CMAKE_BACKWARDS_COMPATIBILITY mark + Factor AIX and XL compiler flags into common module + Move RPATH flags to AIX per-compiler information files + Initialize ASM rpath flags for executables with those for shared libs + Add ASM platform information for XL compiler on AIX + Factor HP compiler flags into per-platform/per-compiler files + Add ASM platform information for HP compiler on HP + Add target property LINK_SEARCH_START_STATIC to aid static linking + Test static linking with LINK_SEARCH_START_STATIC + Fix Assembler test to parse C flags string before using + Teach Assembler test to generate main.s at build time + Do not bother enabling C++ in Assembler test + The link interface of MODULE libraries is empty (#11945) + CTest: Do not fail with submodules and Git < 1.6.5.0 + Remove trailing whitespace + Add parens in cmTarget::ComputeLinkInterface logic + Validate custom command arguments (#11963) + Factor old-style -D flags out from -I flag generation + FindMPI: Fix documentation formatting + Generate target-wide flags before individual build rules + Optionally pass include directories with response files + Pass include directories with response files to GNU on Windows + Enable Java test more carefully on Apple + Disable Java test with Xcode generator + Allow '.' in target names in generator expressions (#12002) + GNUInstallDirs: Propagate DATAROOTDIR changes to dependent defaults + KWSys: Do not trust EXECUTABLE_OUTPUT_PATH for ProcessFwd9x encoding + Refine unused cache variable warning + Fix unused cache warning after multiple configure iterations + FortranCInterface: Fix mangling detection with Cray Fortran >= 7.3.2 + Fix typo in include_directories documentation (#12020) + KWSys: Recognize rxvt-unicode-256color terminal (#12013) + Normalize slashes of add_custom_(command|target) DEPENDS (#11973) + COMP: Fix build against non-standard outside libarchive + Modules: Add comment and copyright notice validation to readme.txt + cmArchiveWrite: Clear xattr and acl from entries (#11958) + find_package: Forward component list for recursive calls in modules + XL: Set C++ and Fortran flags consistently with C + XL: Consolidate compiler flag information + XL: Avoid copying archives into shared libraries that link them + VS10: Fix working directory of consecutive custom commands (#11938) + Fix working drive of make rules on Windows + Change working drive only in MinGW Makefiles + VS: Use setlocal/endlocal only in VS 10 custom commands + VS10: Fix exit code of custom commands with setlocal/endlocal (#11938) + KWSys: Remove unused CheckCXXSourceRuns cmake module + find_package: Rename implementation of user package registry + find_package: Cleanup user package registry less aggressively + find_package: Document user package registry locations + find_package: Search a "system package registry" + find_package: Check both 32-bit and 64-bit registry views + find_package: Test system package registry when possible + find_package: Fix system package registry test path conversion + FindITK: Use passthru find_package config mode for messages + OpenBSD: Use 'arch -s' for host processor (#12143) + Fix case typo in CMAKE_BUILD_TYPE docs (#12148) + KWSys: Fix leaked FILE in EncodeExecutable error case + ENH: Fix Intel 12 plugin project generation for VS < 10 + Revert "Honor RULE_MESSAGES property for build target messages" (#12190) + Fix signed/unsigned comparison in EscapeJSON + Fix run_compile_commands build on Apple GCC 3.3 + Make std::map usage more portable in language=>flags/defines maps + Provide std::map<>::at for use in run_compile_commands + run_compile_commands: Avoid shadow in std::map<>::at workaround + Improve string(RANDOM) default seed + run_compile_commands: Avoid extra stl vector conversion + VS 6: Define _WIN32_WINNT to load wincrypt.h correctly + run_compile_commands: Cast istream::get() result to char + Fix CompileCommandOutput test for Make tools not supporting spaces + Explicitly cast time value in cmSystemTools::RandomSeed + Fix CompileCommandOutput test build on Windows + Add Absoft Fortran compiler id and basic flags + Absoft: Detect implicit link libraries on Linux and Mac + Absoft: Enable FortranCInterface check in Fortran test + Document status of output_required_files command (#12214) + Fix forced-seed argument type in string(RANDOM) + +Clement Creusot (2): + Add new module Armadillo + Corrected copyright format in FindArmadillo.cmake + +Clinton Stimpson (8): + Change to use fphsa to check required variables and version. + Fix grouping bug where "Ungrouped Entries" showed up as a child. + When checking find_package() components, special case qtmain. + Fix issues with find_path() for QtCore include dir on Mac. Fixes 11868. + Fix regression in 43cb9b8. + Speed up creation of parameters file for moc custom command. + Combine component packaging methods into an enum. + Add component support to DragNDrop generator. + +David Cole (34): + ExternalProject Test: Increase test timeout value + CFBundle Test: Add PATHS for finding Rez (#11295) + CTest: Mark DART_TESTING_TIMEOUT as advanced (#10150) + Xcode: Allow override of CMAKE_CONFIGURATION_TYPES (#8914) + Tests: Eliminate unnecessary files and variables. + VS9: Map enable/disable PREfast flags (#10638) + Strip trailing space from xcode-select output (#10723) + CTest: Add alias for make test target (#4564) + Add CMAKE_SCRIPT_MODE_FILE variable (#2828) + Add CMAKE_ARGC and CMAKE_ARGV0..N-1 variables (#2828) + Fix KWStyle line-too-long complaint (#2828) + Documentation: Sync two differing copies of -E docs (#10446) + Clarify list subcommand documentation (#8154) + VS2010: Fixed GenerateManifest flag (#10704) + VS: Only use /MANIFEST if hasManifest is true (#11216) + Make file DOWNLOAD less noisy (#11761) + Begin post-2.8.4 development + Use stable_sort to preserve test order (#11877) + Implement file(UPLOAD (#11286) + Fix KWStyle line too long error (#11286) + ExternalProject: Extract file names from more urls + InstallRequiredSystemLibraries: Read reg values with get_filename_component + Add correct module notice header. + If getconf returns empty output, try cpuinfo. (#11302) + Add ProcessorCount support for QNX via pidin. (#11302) + Compare ProcessorCount to SystemInformation count. (#11302) + ProcessorCount test: more output, do not fail. (#11302) + ProcessorCount: Add support for remaining platforms (#11302) + ProcessorCount: Test fails if count is 0 (#11302) + ProcessorCount: Use ERROR_QUIET with execute_process (#11302) + ExternalProject: Add SVN_TRUST_CERT argument + CMake: Clarify the --debug-trycompile help text + ExternalProject: Always use --non-interactive with svn + VS10: Write header-only files in correct xml element (#11925) + +Eric NOULARD (25): + CPackRPM honors all the different ways of packaging components + CPackRPM fix IRIX compiler warning (variable never used) + CPack remove "-ALL" suffix for ALL-IN-ONE packages + CPack Authorize DISPLAY_NAME usage in component package + CPack fix KWStyle warning + CPack remove previously CPack generated files (if any) before running CPack + CPackRPM Replace space in some CPACK_ vars (Fix bug 9932) + CPackRPM activate CPackRPM test on Linux systems where rpmbuild is found + CPackArchive package all components specified in CPACK_COMPONENTS_ALL + CPack more robust way to collect files belonging to a component + CPackRPM do not run test if build dir contains space + CPack fix compile error on VS70 and avoid KWStyle warnings + CPackRPM add more trace output in order to help failing diagnostics + CPackRPM even more trace in debug mode or in case of failure + CPackRPM non matching ENDIF + CPack try to please SUSE 64 bits and install lib in lib64 and not lib. + Remove debbuging typo + CPack fix CPackDeb crash when CPackDeb.cmake ends with a FATAL_ERROR + CPack fix #11930 and simplifies component packaging options + Fix #11964 Handle lib64 library on Linux + Fix KWStyle warnings + Split CPack.cmake in more manageable parts + Fix KWStyle warnings + CPackRPM Fix #12096: handle absolute install path with component install + CPack make RPM work on AIX. fix #0012183 merge patch from Pasi Valminen + +James Bigler (1): + Add FloatingPointModel to the list of known VS7 generator flags. + +Johan Björk (1): + XCode: Also qoute [] as needed to set build-configurations. + +Kovarththanan Rajaratnam (1): + Documentation: document platform specific -E commands (#10446) + +M. Konrad (1): + CPackDeb add Component Support to DEB generator fix #0011655 + +Manuel Klimek (6): + refactor flags and defines + cache flags and defines + implement cxx command output + make compile command output optional + Adds a test for the compile command line output. + Only offer the compile command output feature on unix systems + +Marco Craveiro (1): + CTest: Use the gcov --preserve-paths flag (#11717) + +Markus Rathgeb (1): + When cross compiling, don't double-root paths when using find_*. + +Martin Konrad (2): + CPackDeb: Fix #12006 broken package names + CPackDeb: Handle dirs for CONTROL_EXTRA correctly when packaging components + +Mathieu Malaterre (8): + This commit fixes bug #0010316 + Add a new function SWIG_GET_WRAPPER_DEPENDENCIES to UseSWIG.cmake + Add support for Java on HP + Add support for java on fedora + UseSWIG.cmake does not expand $(OutDir) + Add support for new swig 2.0 application + UseSWIG.cmake did not support multiple modules and parallel builds + Add support for FindJava on HP-UX and alpha + +Michael Wild (1): + Add module ProcessorCount.cmake (#11302) + +Modestas Vainius (1): + Documentation: Fix a few typos (#11883) + +Nikita Krupen'ko (1): + Add GNUInstallDirs module to define GNU layout (#3976) + +Philip Lowman (1): + VS7/8/9: Map whole program optimization flags (#10263) + +Richard Bateman (1): + Add support for CFBundle targets on the Mac (#11295) + +Rolf Eike Beer (2): + CTest: catch warning output of Apache Maven + FindZLIB: print library instead of include directory + +Sean McBride (1): + Removed most usage of Carbon in favour of CoreFoundation + +Sebastian Herbst (2): + VS8/9: Add flag map entries for /Zc:wchar_t (#10397) + VS7/8/9: Add flag map for string pooling option (#10397) + +Tim Hütz (1): + Add a string(FIND) sub-command (#11795) + +Todd Gamblin (2): + FindMPI: Handle multiple languages + Added backward compatibility for input as well as output vars. + +Wesley Turner (1): + Ensure executable files have executable permissions. + +Zach Mullen (5): + Implement ctest_upload command + Change 'Files' tag to 'Upload' in Upload.xml + Don't tar/gz ctest_upload() files + Add the FILES keyword to ctest_upload command + cmCTestUploadCommand::CheckArgumentKeyword should return false if not FILES + Changes in CMake 2.8.4 (since 2.8.4-rc2) ---------------------------------------- Alex Neundorf (1): diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake index a877e6e..33f0141 100644 --- a/Modules/CMakeDetermineVSServicePack.cmake +++ b/Modules/CMakeDetermineVSServicePack.cmake @@ -7,6 +7,8 @@ # vc80sp1 # vc90 # vc90sp1 +# vc100 +# vc100sp1 # # Usage: # =========================== @@ -23,8 +25,9 @@ # =========================== #============================================================================= -# Copyright 2009-2010 Kitware, Inc. +# Copyright 2009-2011 Kitware, Inc. # Copyright 2009-2010 Philip Lowman <philip@yhbt.com> +# Copyright 2010-2011 Aaron C. meadows <cmake@shadowguarddev.com> # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -49,43 +52,130 @@ function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version) set(_version "vc90sp1") elseif(${_cl_version} VERSION_EQUAL "16.00.30319.01") set(_version "vc100") + elseif(${_cl_version} VERSION_EQUAL "16.00.40219.01") + set(_version "vc100sp1") else() set(_version "") endif() set(${_OUT_VAR} ${_version} PARENT_SCOPE) endfunction() + +############################################################ +# [INTERNAL] +# Please do not call this function directly +function(_DetermineVSServicePack_FastCheckVersionWithCompiler _SUCCESS_VAR _VERSION_VAR) + if(EXISTS ${CMAKE_CXX_COMPILER}) + execute_process( + COMMAND ${CMAKE_CXX_COMPILER} /? + ERROR_VARIABLE _output + OUTPUT_QUIET + ) + + string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" + _cl_version "${_output}") + + if(_cl_version) + string(REGEX MATCHALL "[0-9]+" + _cl_version_list "${_cl_version}") + list(GET _cl_version_list 0 _major) + list(GET _cl_version_list 1 _minor) + list(GET _cl_version_list 2 _patch) + list(GET _cl_version_list 3 _tweak) + + if("${_major}${_minor}" STREQUAL "${MSVC_VERSION}") + set(_cl_version ${_major}.${_minor}.${_patch}.${_tweak}) + else() + unset(_cl_version) + endif() + endif() + + if(_cl_version) + set(${_SUCCESS_VAR} true PARENT_SCOPE) + set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE) + endif() + endif() +endfunction() + +############################################################ +# [INTERNAL] +# Please do not call this function directly +function(_DetermineVSServicePack_CheckVersionWithTryCompile _SUCCESS_VAR _VERSION_VAR) + file(WRITE "${CMAKE_BINARY_DIR}/return0.cc" + "int main() { return 0; }\n") + + try_compile( + _CompileResult + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/return0.cc" + OUTPUT_VARIABLE _output + COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc") + + file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc") + + string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" + _cl_version "${_output}") + + if(_cl_version) + string(REGEX MATCHALL "[0-9]+" + _cl_version_list "${_cl_version}") + + list(GET _cl_version_list 0 _major) + list(GET _cl_version_list 1 _minor) + list(GET _cl_version_list 2 _patch) + list(GET _cl_version_list 3 _tweak) + + set(${_SUCCESS_VAR} true PARENT_SCOPE) + set(${_VERSION_VAR} ${_major}.${_minor}.${_patch}.${_tweak} PARENT_SCOPE) + endif() +endfunction() + +############################################################ +# [INTERNAL] +# Please do not call this function directly +function(_DetermineVSServicePack_CheckVersionWithTryRun _SUCCESS_VAR _VERSION_VAR) + file(WRITE "${CMAKE_BINARY_DIR}/return0.cc" + "#include <stdio.h>\n\nconst unsigned int CompilerVersion=_MSC_FULL_VER;\n\nint main(int argc, char* argv[])\n{\n int M( CompilerVersion/10000000);\n int m((CompilerVersion%10000000)/100000);\n int b(CompilerVersion%100000);\n\n printf(\"%d.%02d.%05d.01\",M,m,b);\n return 0;\n}\n") + + try_run( + _RunResult + _CompileResult + "${CMAKE_BINARY_DIR}" + "${CMAKE_BINARY_DIR}/return0.cc" + RUN_OUTPUT_VARIABLE _runoutput + ) + + file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc") + + string(REGEX MATCH "[0-9]+.[0-9]+.[0-9]+.[0-9]+" + _cl_version "${_runoutput}") + + if(_cl_version) + set(${_SUCCESS_VAR} true PARENT_SCOPE) + set(${_VERSION_VAR} ${_cl_version} PARENT_SCOPE) + endif() +endfunction() + + # # A function to call to determine the Visual Studio service pack # in use. See documentation above. function(DetermineVSServicePack _pack) if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack}) - file(WRITE "${CMAKE_BINARY_DIR}/return0.cc" - "int main() { return 0; }\n") - - try_compile(DETERMINED_VS_SERVICE_PACK - "${CMAKE_BINARY_DIR}" - "${CMAKE_BINARY_DIR}/return0.cc" - OUTPUT_VARIABLE _output - COPY_FILE "${CMAKE_BINARY_DIR}/return0.cc") - - file(REMOVE "${CMAKE_BINARY_DIR}/return0.cc") - - if(DETERMINED_VS_SERVICE_PACK AND _output) - string(REGEX MATCH "Compiler Version [0-9]+.[0-9]+.[0-9]+.[0-9]+" - _cl_version "${_output}") + + _DetermineVSServicePack_FastCheckVersionWithCompiler(DETERMINED_VS_SERVICE_PACK _cl_version) + if(NOT DETERMINED_VS_SERVICE_PACK) + _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version) + if(NOT DETERMINED_VS_SERVICE_PACK) + _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version) + endif() + endif() + + if(DETERMINED_VS_SERVICE_PACK) + if(_cl_version) - string(REGEX MATCHALL "[0-9]+" - _cl_version_list "${_cl_version}") - list(GET _cl_version_list 0 _major) - list(GET _cl_version_list 1 _minor) - list(GET _cl_version_list 2 _patch) - list(GET _cl_version_list 3 _tweak) - - set(_cl_version_string ${_major}.${_minor}.${_patch}.${_tweak}) - # Call helper function to determine VS version - _DetermineVSServicePackFromCompiler(_sp "${_cl_version_string}") + _DetermineVSServicePackFromCompiler(_sp "${_cl_version}") if(_sp) set(${_pack} ${_sp} CACHE INTERNAL "The Visual Studio Release with Service Pack") diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake index af5f3a7..388203c 100644 --- a/Modules/CMakeVS10FindMake.cmake +++ b/Modules/CMakeVS10FindMake.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2009 Kitware, Inc. +# Copyright 2007-2009 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,17 +12,28 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -# We use MSBuild as the build tool for VS 10 +# VCExpress does not support cross compiling, which is necessary for Win CE +SET( _CMAKE_MAKE_PROGRAM_NAMES devenv) +IF(NOT CMAKE_CROSSCOMPILING) + SET( _CMAKE_MAKE_PROGRAM_NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} VCExpress) +ENDIF(NOT CMAKE_CROSSCOMPILING) + FIND_PROGRAM(CMAKE_MAKE_PROGRAM - NAMES MSBuild + NAMES ${_CMAKE_MAKE_PROGRAM_NAMES} HINTS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;ProductDir] - "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" - "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/" - "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0;CLR Version]/" + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup\\VS;EnvironmentDirectory] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Setup;Dbghelp_path] + "$ENV{ProgramFiles}/Microsoft Visual Studio 10.0/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio10.0/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio 10/Common7/IDE" + "$ENV{ProgramFiles}/Microsoft Visual Studio10/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10.0/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10.0/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio 10/Common7/IDE" + "$ENV{ProgramFiles} (x86)/Microsoft Visual Studio10/Common7/IDE" + "/Program Files/Microsoft Visual Studio 10.0/Common7/IDE/" + "/Program Files/Microsoft Visual Studio 10/Common7/IDE/" ) - MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC10 1) SET(MSVC_VERSION 1600) - diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index 6df2473..50eb787 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -1,15 +1,11 @@ # - Find Armadillo # Find the Armadillo C++ library # -# -# == Using Armadillo: == -# find_package(Armadillo RECQUIRED) +# Using Armadillo: +# find_package(Armadillo REQUIRED) # include_directories(${ARMADILLO_INCLUDE_DIRS}) # add_executable(foo foo.cc) # target_link_libraries(foo ${ARMADILLO_LIBRARIES}) -# -#============================================================================= -# # This module sets the following variables: # ARMADILLO_FOUND - set to true if the library is found # ARMADILLO_INCLUDE_DIRS - list of required include directories @@ -19,7 +15,6 @@ # ARMADILLO_VERSION_PATCH - patch version number # ARMADILLO_VERSION_STRING - version number as a string (ex: "1.0.4") # ARMADILLO_VERSION_NAME - name of the version (ex: "Antipodean Antileech") -# #============================================================================= # Copyright 2011 Clement Creusot <creusot@cs.york.ac.uk> diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index f17e599..c3ac424 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -65,7 +65,7 @@ # 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, # 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0, # 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0, -# 1.45, 1.45.0, 1.46, 1.46.0 +# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1 # # NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should # add both 1.x and 1.x.0 as shown above. Official Boost include directories @@ -281,6 +281,12 @@ macro(_Boost_ADJUST_LIB_VARS basename) set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) endif() + + # If the debug & release library ends up being the same, omit the keywords + if(${Boost_${basename}_LIBRARY_RELEASE} STREQUAL ${Boost_${basename}_LIBRARY_DEBUG}) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} ) + endif() if(Boost_${basename}_LIBRARY) set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") @@ -386,6 +392,7 @@ else(Boost_FIND_VERSION_EXACT) # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} + "1.46.1" "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 5921101..d49b44a 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -105,6 +105,7 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES /usr/local/lib /usr/lib/jvm/java/lib /usr/lib/java/jre/lib/{libarch} + /usr/lib/jvm/jre/lib/{libarch} /usr/local/lib/java/jre/lib/{libarch} /usr/local/share/java/jre/lib/{libarch} /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 6431836..1b11a34 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -5,6 +5,8 @@ # # Java_JAVA_EXECUTABLE = the full path to the Java runtime # Java_JAVAC_EXECUTABLE = the full path to the Java compiler +# Java_JAVAH_EXECUTABLE = the full path to the Java header generator +# Java_JAVADOC_EXECUTABLE = the full path to the Java documention generator # Java_JAR_EXECUTABLE = the full path to the Java archiver # Java_VERSION_STRING = Version of the package found (java version), eg. 1.6.0_12 # Java_VERSION_MAJOR = The major version of the package found. @@ -150,6 +152,18 @@ FIND_PROGRAM(Java_JAVAC_EXECUTABLE PATHS ${_JAVA_PATHS} ) +FIND_PROGRAM(Java_JAVAH_EXECUTABLE + NAMES javah + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + +FIND_PROGRAM(Java_JAVADOC_EXECUTABLE + NAMES javadoc + HINTS ${_JAVA_HINTS} + PATHS ${_JAVA_PATHS} +) + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) if(Java_FIND_COMPONENTS) foreach(component ${Java_FIND_COMPONENTS}) @@ -162,6 +176,7 @@ if(Java_FIND_COMPONENTS) elseif(component STREQUAL "Development") find_package_handle_standard_args(Java REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE + Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE VERSION_VAR Java_VERSION ) else() @@ -173,6 +188,7 @@ else() # Check for everything find_package_handle_standard_args(Java REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE + Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE VERSION_VAR Java_VERSION ) endif() @@ -182,6 +198,8 @@ MARK_AS_ADVANCED( Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE + Java_JAVAH_EXECUTABLE + Java_JAVADOC_EXECUTABLE ) # LEGACY diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 8c60bcb..2e34eb1 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -27,7 +27,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(SWIG_EXECUTABLE swig2.0 swig) +FIND_PROGRAM(SWIG_EXECUTABLE NAMES swig2.0 swig) IF(SWIG_EXECUTABLE) EXECUTE_PROCESS(COMMAND ${SWIG_EXECUTABLE} -swiglib diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake new file mode 100644 index 0000000..869394d --- /dev/null +++ b/Modules/UseJava.cmake @@ -0,0 +1,858 @@ +# - Use Module for Java +# This file provides functions for Java. It is assumed that FindJava.cmake +# has already been loaded. See FindJava.cmake for information on how to +# load Java into your CMake project. +# +# add_jar(TARGET_NAME SRC1 SRC2 .. SRCN RCS1 RCS2 .. RCSN) +# +# This command creates a <TARGET_NAME>.jar. It compiles the given source +# files (SRC) and adds the given resource files (RCS) to the jar file. +# If only resource files are given then just a jar file is created. +# +# Additional instructions: +# To add compile flags to the target you can set these flags with +# the following variable: +# +# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) +# +# To add a path or a jar file to the class path you can do this +# with the CMAKE_JAVA_INCLUDE_PATH variable. +# +# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) +# +# To use a different output name for the target you can set it with: +# +# set(CMAKE_JAVA_TARGET_OUTPUT_NAME shibboleet.jar) +# add_jar(foobar foobar.java) +# +# To add a VERSION to the target output name you can set it using +# CMAKE_JAVA_TARGET_VERSION. This will create a jar file with the name +# shibboleet-1.0.0.jar and will create a symlink shibboleet.jar +# pointing to the jar with the version information. +# +# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) +# add_jar(shibboleet shibbotleet.java) +# +# If the target is a JNI library, utilize the following commands to +# create a JNI symbolic link: +# +# set(CMAKE_JNI_TARGET TRUE) +# set(CMAKE_JAVA_TARGET_VERSION 1.2.0) +# add_jar(shibboleet shibbotleet.java) +# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) +# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) +# +# If a single target needs to produce more than one jar from its +# java source code, to prevent the accumulation of duplicate class +# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior +# to calling the add_jar() function: +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) +# add_jar(foo foo.java) +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) +# add_jar(bar bar.java) +# +# Target Properties: +# The add_jar() functions sets some target properties. You can get these +# properties with the +# get_property(TARGET <target_name> PROPERTY <propery_name>) +# command. +# +# INSTALL_FILES The files which should be installed. This is used by +# install_jar(). +# JNI_SYMLINK The JNI symlink which should be installed. +# This is used by install_jni_symlink(). +# JAR_FILE The location of the jar file so that you can include +# it. +# CLASS_DIR The directory where the class files can be found. For +# example to use them with javah. +# +# find_jar(<VAR> +# name | NAMES name1 [name2 ...] +# [PATHS path1 [path2 ... ENV var]] +# [VERSIONS version1 [version2]] +# [DOC "cache documentation string"] +# ) +# +# This command is used to find a full path to the named jar. A cache +# entry named by <VAR> is created to stor the result of this command. If +# the full path to a jar is found the result is stored in the variable +# and the search will not repeated unless the variable is cleared. If +# nothing is found, the result will be <VAR>-NOTFOUND, and the search +# will be attempted again next time find_jar is invoked with the same +# variable. +# The name of the full path to a file that is searched for is specified +# by the names listed after NAMES argument. Additional search locations +# can be specified after the PATHS argument. If you require special a +# version of a jar file you can specify it with the VERSIONS argument. +# The argument after DOC will be used for the documentation string in +# the cache. +# +# install_jar(TARGET_NAME DESTINATION) +# +# This command installs the TARGET_NAME files to the given DESTINATION. +# It should be called in the same scope as add_jar() or it will fail. +# +# install_jni_symlink(TARGET_NAME DESTINATION) +# +# This command installs the TARGET_NAME JNI symlinks to the given +# DESTINATION. It should be called in the same scope as add_jar() +# or it will fail. +# +# create_javadoc(<VAR> +# PACKAGES pkg1 [pkg2 ...] +# [SOURCEPATH <sourcepath>] +# [CLASSPATH <classpath>] +# [INSTALLPATH <install path>] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# Create jave documentation based on files or packages. For more +# details please read the javadoc manpage. +# +# There are two main signatures for create_javadoc. The first +# signature works with package names on a path with source files: +# +# Example: +# create_javadoc(my_example_doc +# PACKAGES com.exmaple.foo com.example.bar +# SOURCEPATH ${CMAKE_CURRENT_SOURCE_PATH} +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "<h1>My example</h1>" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# The second signature for create_javadoc works on a given list of +# files. +# +# create_javadoc(<VAR> +# FILES file1 [file2 ...] +# [CLASSPATH <classpath>] +# [INSTALLPATH <install path>] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# Example: +# create_javadoc(my_example_doc +# FILES ${example_SRCS} +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "<h1>My example</h1>" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# Both signatures share most of the options. These options are the +# same as what you can find in the javadoc manpage. Please look at +# the manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and +# VERSION. +# +# The documentation will be by default installed to +# +# ${CMAKE_INSTALL_PREFIX}/share/javadoc/<VAR> +# +# if you don't set the INSTALLPATH. +# + +#============================================================================= +# Copyright 2010-2011 Andreas schneider <asn@redhat.com> +# Copyright 2010 Ben Boeckel <ben.boeckel@kitware.com> +# +# 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.) + +function (__java_copy_file src dest comment) + add_custom_command( + OUTPUT ${dest} + COMMAND cmake -E copy_if_different + ARGS ${src} + ${dest} + DEPENDS ${src} + COMMENT ${comment}) +endfunction (__java_copy_file src dest comment) + +# define helper scripts +set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) +set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) + +function(add_jar _TARGET_NAME) + set(_JAVA_SOURCE_FILES ${ARGN}) + + if (LIBRARY_OUTPUT_PATH) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) + else (LIBRARY_OUTPUT_PATH) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}) + endif (LIBRARY_OUTPUT_PATH) + + set(CMAKE_JAVA_INCLUDE_PATH + ${CMAKE_JAVA_INCLUDE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_JAVA_OBJECT_OUTPUT_PATH} + ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} + ) + + if (WIN32 AND NOT CYGWIN) + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") + else (WIN32 AND NOT CYGWIN) + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") + endif(WIN32 AND NOT CYGWIN) + + foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") + endforeach(JAVA_INCLUDE_DIR) + + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") + if (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") + elseif (CMAKE_JAVA_TARGET_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${CMAKE_JAVA_TARGET_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") + elseif (CMAKE_JAVA_TARGET_OUTPUT_NAME) + set(_JAVA_TARGET_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}.jar") + endif (CMAKE_JAVA_TARGET_OUTPUT_NAME AND CMAKE_JAVA_TARGET_VERSION) + # reset + set(CMAKE_JAVA_TARGET_OUTPUT_NAME) + + set(_JAVA_CLASS_FILES) + set(_JAVA_COMPILE_FILES) + set(_JAVA_DEPENDS) + set(_JAVA_RESOURCE_FILES) + foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) + get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) + get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) + get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) + + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${CMAKE_CURRENT_BINARY_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) + string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) + string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) + if (${_BIN_LEN} LESS ${_SRC_LEN}) + set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) + else (${_BIN_LEN} LESS ${_SRC_LEN}) + set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) + endif (${_BIN_LEN} LESS ${_SRC_LEN}) + get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) + + if (_JAVA_EXT MATCHES ".java") + list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) + set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) + + elseif (_JAVA_EXT MATCHES ".jar") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_SOURCE_FILE}) + + elseif (_JAVA_EXT STREQUAL "") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) + list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) + + else (_JAVA_EXT MATCHES ".java") + __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} + ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} + "Copying ${_JAVA_SOURCE_FILE} to the build directory") + list(APPEND _JAVA_RESOURCE_FILES ${_JAVA_SOURCE_FILE}) + endif (_JAVA_EXT MATCHES ".java") + endforeach(_JAVA_SOURCE_FILE) + + # create an empty java_class_filelist + if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") + endif() + + if (_JAVA_COMPILE_FILES) + # Compile the java files and create a list of class files + add_custom_command( + # NOTE: this command generates an artificial dependency file + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + COMMAND ${Java_JAVAC_EXECUTABLE} + ${CMAKE_JAVA_COMPILE_FLAGS} + -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" + -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ${_JAVA_COMPILE_FILES} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + DEPENDS ${_JAVA_COMPILE_FILES} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building Java objects for ${_TARGET_NAME}.jar" + ) + add_custom_command( + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMAND ${CMAKE_COMMAND} + -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} + -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" + -P ${_JAVA_CLASS_FILELIST_SCRIPT} + DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + endif (_JAVA_COMPILE_FILES) + + # create the jar file + if (CMAKE_JNI_TARGET) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + COMMAND ${Java_JAR_EXECUTABLE} + -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${_JAVA_RESOURCE_FILES} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + else () + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + COMMAND ${Java_JAR_EXECUTABLE} + -cf ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${_JAVA_RESOURCE_FILES} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + endif (CMAKE_JNI_TARGET) + + # Add the target and make sure we have the latest resource files. + add_custom_target(${_TARGET_NAME} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ) + + if (_JAVA_TARGET_OUTPUT_LINK) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + + if (CMAKE_JNI_TARGET) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + endif (CMAKE_JNI_TARGET) + endif (_JAVA_TARGET_OUTPUT_LINK) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JAR_FILE + ${CMAKE_CURRENT_BINARY_DIR}/${_JAVA_TARGET_OUTPUT_NAME} + ) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + CLASSDIR + ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ) + +endfunction(add_jar) + +function(INSTALL_JAR _TARGET_NAME _DESTINATION) + get_property(__FILES + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ) + + if (__FILES) + install( + FILES + ${__FILES} + DESTINATION + ${_DESTINATION} + ) + else (__FILES) + message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + endif (__FILES) +endfunction(INSTALL_JAR _TARGET_NAME _DESTINATION) + +function(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) + get_property(__SYMLINK + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ) + + if (__SYMLINK) + install( + FILES + ${__SYMLINK} + DESTINATION + ${_DESTINATION} + ) + else (__SYMLINK) + message(SEND_ERROR "The target ${_TARGET_NAME} is not known in this scope.") + endif (__SYMLINK) +endfunction(INSTALL_JNI_SYMLINK _TARGET_NAME _DESTINATION) + +function (find_jar VARIABLE) + set(_jar_names) + set(_jar_files) + set(_jar_versions) + set(_jar_paths + /usr/share/java/ + /usr/local/share/java/ + ${Java_JAR_PATHS}) + set(_jar_doc "NOTSET") + + set(_state "name") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "name") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else (${arg} STREQUAL "NAMES") + set(_jar_names ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif (_jar_doc STREQUAL "NOTSET") + endif (${arg} STREQUAL "VERSIONS") + elseif (${_state} STREQUAL "versions") + if (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else (${arg} STREQUAL "NAMES") + set(_jar_versions ${_jar_versions} ${arg}) + endif (${arg} STREQUAL "NAMES") + elseif (${_state} STREQUAL "names") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else (${arg} STREQUAL "VERSIONS") + set(_jar_names ${_jar_names} ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif (_jar_doc STREQUAL "NOTSET") + endif (${arg} STREQUAL "VERSIONS") + elseif (${_state} STREQUAL "paths") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else (${arg} STREQUAL "VERSIONS") + set(_jar_paths ${_jar_paths} ${arg}) + endif (${arg} STREQUAL "VERSIONS") + elseif (${_state} STREQUAL "doc") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + else (${arg} STREQUAL "VERSIONS") + set(_jar_doc ${arg}) + endif (${arg} STREQUAL "VERSIONS") + endif (${_state} STREQUAL "name") + endforeach (arg ${ARGN}) + + if (${_jar_names} STREQUAL "") + message(FATAL_ERROR "find_jar: No name to search for given") + endif (${_jar_names} STREQUAL "") + + foreach (jar_name ${_jar_names}) + foreach (version ${_jar_versions}) + set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) + endforeach (version ${_jar_versions}) + set(_jar_files ${_jar_files} ${jar_name}.jar) + endforeach (jar_name ${_jar_names}) + + find_file(${VARIABLE} + NAMES ${_jar_files} + PATHS ${_jar_paths} + DOC ${_jar_doc} + NO_DEFAULT_PATH) +endfunction (find_jar VARIABLE) + +function(create_javadoc _target) + set(_javadoc_packages) + set(_javadoc_files) + set(_javadoc_sourcepath) + set(_javadoc_classpath) + set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc") + set(_javadoc_doctitle) + set(_javadoc_windowtitle) + set(_javadoc_author FALSE) + set(_javadoc_version FALSE) + set(_javadoc_use FALSE) + + set(_state "package") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "package") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_packages ${arg}) + set(_state "packages") + endif () + elseif (${_state} STREQUAL "packages") + if (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_packages ${arg}) + endif () + elseif (${_state} STREQUAL "files") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_files ${arg}) + endif () + elseif (${_state} STREQUAL "sourcepath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_sourcepath ${arg}) + endif () + elseif (${_state} STREQUAL "classpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_classpath ${arg}) + endif () + elseif (${_state} STREQUAL "installpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_installpath ${arg}) + endif () + elseif (${_state} STREQUAL "doctitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_doctitle ${arg}) + endif () + elseif (${_state} STREQUAL "windowtitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_windowtitle ${arg}) + endif () + elseif (${_state} STREQUAL "author") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_author ${arg}) + endif () + elseif (${_state} STREQUAL "use") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_use ${arg}) + endif () + elseif (${_state} STREQUAL "version") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_version ${arg}) + endif () + endif (${_state} STREQUAL "package") + endforeach (arg ${ARGN}) + + set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target}) + set(_javadoc_options -d ${_javadoc_builddir}) + + if (_javadoc_sourcepath) + set(_start TRUE) + foreach(_path ${_javadoc_sourcepath}) + if (_start) + set(_sourcepath ${_path}) + set(_start FALSE) + else (_start) + set(_sourcepath ${_sourcepath}:${_path}) + endif (_start) + endforeach(_path ${_javadoc_sourcepath}) + set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) + endif (_javadoc_sourcepath) + + if (_javadoc_classpath) + set(_start TRUE) + foreach(_path ${_javadoc_classpath}) + if (_start) + set(_classpath ${_path}) + set(_start FALSE) + else (_start) + set(_classpath ${_classpath}:${_path}) + endif (_start) + endforeach(_path ${_javadoc_classpath}) + set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") + endif (_javadoc_classpath) + + if (_javadoc_doctitle) + set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') + endif (_javadoc_doctitle) + + if (_javadoc_windowtitle) + set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') + endif (_javadoc_windowtitle) + + if (_javadoc_author) + set(_javadoc_options ${_javadoc_options} -author) + endif (_javadoc_author) + + if (_javadoc_use) + set(_javadoc_options ${_javadoc_options} -use) + endif (_javadoc_use) + + if (_javadoc_version) + set(_javadoc_options ${_javadoc_options} -version) + endif (_javadoc_version) + + add_custom_target(${_target}_javadoc ALL + COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} + ${_javadoc_files} + ${_javadoc_packages} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + DIRECTORY ${_javadoc_builddir} + DESTINATION ${_javadoc_installpath} + ) +endfunction(create_javadoc) diff --git a/Modules/UseJavaClassFilelist.cmake b/Modules/UseJavaClassFilelist.cmake new file mode 100644 index 0000000..c842bf7 --- /dev/null +++ b/Modules/UseJavaClassFilelist.cmake @@ -0,0 +1,52 @@ +# +# This script create a list of compiled Java class files to be added to a +# jar file. This avoids including cmake files which get created in the +# binary directory. +# + +#============================================================================= +# Copyright 2010-2011 Andreas schneider <asn@redhat.com> +# +# 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.) + +if (CMAKE_JAVA_CLASS_OUTPUT_PATH) + if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") + + set(_JAVA_GLOBBED_FILES) + if (CMAKE_JAR_CLASSES_PREFIX) + foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) + message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}") + + file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") + if (_JAVA_GLOBBED_TMP_FILES) + list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) + endif (_JAVA_GLOBBED_TMP_FILES) + endforeach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) + else() + file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class") + endif (CMAKE_JAR_CLASSES_PREFIX) + + set(_JAVA_CLASS_FILES) + # file(GLOB_RECURSE foo RELATIVE) is broken so we need this. + foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) + file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE}) + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n) + endforeach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) + + # write to file + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES}) + + else (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") + message(SEND_ERROR "FATAL: Java class output path doesn't exist") + endif (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") +else (CMAKE_JAVA_CLASS_OUTPUT_PATH) + message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH") +endif (CMAKE_JAVA_CLASS_OUTPUT_PATH) diff --git a/Modules/UseJavaSymlinks.cmake b/Modules/UseJavaSymlinks.cmake new file mode 100644 index 0000000..c66ee1e --- /dev/null +++ b/Modules/UseJavaSymlinks.cmake @@ -0,0 +1,32 @@ +# +# Helper script for UseJava.cmake +# + +#============================================================================= +# Copyright 2010-2011 Andreas schneider <asn@redhat.com> +# +# 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.) + +if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) + if (_JAVA_TARGET_OUTPUT_NAME) + find_program(LN_EXECUTABLE + NAMES + ln + ) + + execute_process( + COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}" + WORKING_DIRECTORY ${_JAVA_TARGET_DIR} + ) + else (_JAVA_TARGET_OUTPUT_NAME) + message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME") + endif (_JAVA_TARGET_OUTPUT_NAME) +endif (UNIX AND _JAVA_TARGET_OUTPUT_LINK) diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index be15b52..2a83045 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -4,9 +4,6 @@ # - Define swig module with given name and specified language # SWIG_LINK_LIBRARIES(name [ libraries ]) # - Link libraries to swig module -# SWIG_GET_WRAPPER_DEPENDENCIES(swigFile genWrapper language DEST_VARIABLE) -# - Put dependencies of the wrapper genWrapper generated by swig from -# swigFile in DEST_VARIABLE # All other macros are for internal use only. # To get the actual name of the swig module, # use: ${SWIG_MODULE_${name}_REAL_NAME}. @@ -42,58 +39,6 @@ SET(SWIG_EXTRA_LIBRARIES "") SET(SWIG_PYTHON_EXTRA_FILE_EXTENSION "py") # -# Get dependencies of the generated wrapper. -# -MACRO(SWIG_GET_WRAPPER_DEPENDENCIES swigFile genWrapper language DEST_VARIABLE) - GET_FILENAME_COMPONENT(swig_getdeps_basename ${swigFile} NAME_WE) - GET_FILENAME_COMPONENT(swig_getdeps_outdir ${genWrapper} PATH) - GET_SOURCE_FILE_PROPERTY(swig_getdeps_extra_flags "${swigFile}" SWIG_FLAGS) - IF("${swig_getdeps_extra_flags}" STREQUAL "NOTFOUND") - SET(swig_getdeps_extra_flags "") - ENDIF("${swig_getdeps_extra_flags}" STREQUAL "NOTFOUND") - - IF(NOT swig_getdeps_outdir) - SET(swig_getdeps_outdir ${CMAKE_CURRENT_BINARY_DIR}) - ENDIF(NOT swig_getdeps_outdir) - SET(swig_getdeps_depsfile - ${swig_getdeps_outdir}/swig_${swig_getdeps_basename}_deps.txt) - GET_DIRECTORY_PROPERTY(swig_getdeps_include_directories INCLUDE_DIRECTORIES) - SET(swig_getdeps_include_dirs) - FOREACH(it ${swig_getdeps_include_directories}) - SET(swig_getdeps_include_dirs ${swig_getdeps_include_dirs} "-I${it}") - ENDFOREACH(it) - EXECUTE_PROCESS( - COMMAND ${SWIG_EXECUTABLE} - -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags} - ${CMAKE_SWIG_FLAGS} -${language} - -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile} - RESULT_VARIABLE swig_getdeps_result - ERROR_VARIABLE swig_getdeps_error - OUTPUT_STRIP_TRAILING_WHITESPACE) - IF(NOT ${swig_getdeps_error} EQUAL 0) - MESSAGE(SEND_ERROR "Command \"${SWIG_EXECUTABLE} -MM -MF ${swig_getdeps_depsfile} ${swig_getdeps_extra_flags} ${CMAKE_SWIG_FLAGS} -${language} -o ${genWrapper} ${swig_getdeps_include_dirs} ${swigFile}\" failed with output:\n${swig_getdeps_error}") - SET(swig_getdeps_dependencies "") - ELSE(NOT ${swig_getdeps_error} EQUAL 0) - FILE(READ ${swig_getdeps_depsfile} ${DEST_VARIABLE}) - # Remove the first line - STRING(REGEX REPLACE "^.+: +\\\\\n +" "" - ${DEST_VARIABLE} "${${DEST_VARIABLE}}") - # Clean the end of each line - STRING(REGEX REPLACE " +(\\\\)?\n" "\n" ${DEST_VARIABLE} - "${${DEST_VARIABLE}}") - # Clean beginning of each line - STRING(REGEX REPLACE "\n +" "\n" - ${DEST_VARIABLE} "${${DEST_VARIABLE}}") - # clean paths - STRING(REGEX REPLACE "\\\\\\\\" "/" ${DEST_VARIABLE} - "${${DEST_VARIABLE}}") - STRING(REGEX REPLACE "\n" ";" - ${DEST_VARIABLE} "${${DEST_VARIABLE}}") - ENDIF(NOT ${swig_getdeps_error} EQUAL 0) -ENDMACRO(SWIG_GET_WRAPPER_DEPENDENCIES) - - -# # For given swig module initialize variables associated with it # MACRO(SWIG_MODULE_INITIALIZE name language) @@ -220,10 +165,6 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) IF(SWIG_MODULE_${name}_EXTRA_FLAGS) SET(swig_extra_flags ${swig_extra_flags} ${SWIG_MODULE_${name}_EXTRA_FLAGS}) ENDIF(SWIG_MODULE_${name}_EXTRA_FLAGS) - SWIG_GET_WRAPPER_DEPENDENCIES("${swig_source_file_fullname}" - "${swig_generated_file_fullname}" ${SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG} - swig_extra_dependencies) - LIST(APPEND SWIG_MODULE_${name}_EXTRA_DEPS ${swig_extra_dependencies}) ADD_CUSTOM_COMMAND( OUTPUT "${swig_generated_file_fullname}" ${swig_extra_generated_files} # Let's create the ${swig_outdir} at execution time, in case dir contains $(OutDir) diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx index 342c217..1021bf2 100644 --- a/Source/cmComputeLinkDepends.cxx +++ b/Source/cmComputeLinkDepends.cxx @@ -69,7 +69,7 @@ We can also infer the edge because *every* time A appears B is seen on its right. We do not know whether A really needs symbols from B to link, but it *might* so we must preserve their order. This is the case also for the following -explict lists: +explicit lists: X: A B Y Y: A B diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index 6355a85..2fa2cca 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -164,11 +164,6 @@ void cmFindLibraryCommand::AddArchitecturePaths(const char* suffix) void cmFindLibraryCommand::AddLib64Paths() { - if(!this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> - GetLanguageEnabled("C")) - { - return; - } std::string voidsize = this->Makefile->GetSafeDefinition("CMAKE_SIZEOF_VOID_P"); int size = atoi(voidsize.c_str()); diff --git a/Source/cmGlobalMinGWMakefileGenerator.cxx b/Source/cmGlobalMinGWMakefileGenerator.cxx index 2f558dc..a9e7798 100644 --- a/Source/cmGlobalMinGWMakefileGenerator.cxx +++ b/Source/cmGlobalMinGWMakefileGenerator.cxx @@ -66,18 +66,6 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator() lg->SetPassMakeflags(false); lg->SetUnixCD(true); lg->SetMinGWMake(true); - - // mingw32-make has trouble running code like - // - // @echo message with spaces - // - // If quotes are added - // - // @echo "message with spaces" - // - // it runs but the quotes are displayed. Instead just use cmake to - // echo. - lg->SetNativeEchoCommand("@$(CMAKE_COMMAND) -E echo ", false); return lg; } diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 2ee95c0..ec8f4a5 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -123,7 +123,8 @@ std::string cmGlobalVisualStudio10Generator cmSystemTools::LowerCase(lowerCaseCommand); // If makeProgram is devenv, parent class knows how to generate command: - if (lowerCaseCommand.find("devenv") != std::string::npos) + if (lowerCaseCommand.find("devenv") != std::string::npos || + lowerCaseCommand.find("VCExpress") != std::string::npos) { return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram, projectName, additionalOptions, targetName, config, ignoreErrors, fast); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 5c2cda1..6ab5c2a 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -68,8 +68,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() this->ColorMakefile = false; this->SkipPreprocessedSourceRules = false; this->SkipAssemblySourceRules = false; - this->NativeEchoCommand = "@echo "; - this->NativeEchoWindows = true; this->MakeCommandEscapeTargetTwice = false; this->IsMakefileGenerator = true; this->BorlandMakeCurlyHack = false; @@ -1235,9 +1233,8 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector<std::string>& commands, if(color_name.empty()) { // Use the native echo command. - cmd = this->NativeEchoCommand; - cmd += this->EscapeForShell(line.c_str(), false, - this->NativeEchoWindows); + cmd = "@echo "; + cmd += this->EscapeForShell(line.c_str(), false, true); } else { diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 9ff6e5e..0994222 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -127,14 +127,6 @@ public: void SetSilentNoColon(bool v) {this->SilentNoColon = v;} /** - * Set the command to use for native make shell echo. The value - * should include all parts of the command up to the beginning of - * the message (including a whitespace separator). - */ - void SetNativeEchoCommand(const char* cmd, bool isWindows) - { this->NativeEchoCommand = cmd; this->NativeEchoWindows = isWindows; } - - /** * Set the string used to include one makefile into another default * is include. */ @@ -365,8 +357,6 @@ private: std::string IncludeDirective; std::string MakeSilentFlag; std::string ConfigurationName; - std::string NativeEchoCommand; - bool NativeEchoWindows; bool DefineWindowsNULL; bool UnixCD; bool PassMakeflags; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7bd5372..52b9072 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -590,7 +590,7 @@ void cmTarget::DefineProperties(cmake *cm) "For an executable with exports (see the ENABLE_EXPORTS property) " "no default transitive link dependencies are used. " "This property replaces the default transitive link dependencies with " - "an explict list. " + "an explicit list. " "When the target is linked into another target the libraries " "listed (and recursively their link interface libraries) will be " "provided to the other target also. " diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 2a4ff92..d710405 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -378,7 +378,11 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source, static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); this->WriteString("<CustomBuild Include=\"", 2); - std::string path = sourcePath; + // custom command have to use relative paths or they do not + // show up in the GUI + std::string path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + sourcePath.c_str()); this->ConvertToWindowsSlash(path); (*this->BuildFileStream ) << path << "\">\n"; for(std::vector<std::string>::iterator i = configs->begin(); @@ -619,6 +623,14 @@ WriteGroupSources(const char* name, const char* filter = sourceGroup.GetFullName(); this->WriteString("<", 2); std::string path = source; + // custom command sources must use relative paths or they will + // not show up in the GUI. + if(sf->GetCustomCommand()) + { + path = cmSystemTools::RelativePath( + this->Makefile->GetCurrentOutputDirectory(), + source.c_str()); + } this->ConvertToWindowsSlash(path); (*this->BuildFileStream) << name << " Include=\"" << path; @@ -706,6 +718,8 @@ void cmVisualStudio10TargetGenerator::WriteCLSources() bool rc = lang && (strcmp(lang, "RC") == 0); bool idl = ext == "idl"; std::string sourceFile = (*source)->GetFullPath(); + // do not use a relative path here because it means that you + // can not use as long a path to the file. this->ConvertToWindowsSlash(sourceFile); // output the source file if(header) diff --git a/Source/kwsys/Terminal.c b/Source/kwsys/Terminal.c index 7a3266f..25832c2 100644 --- a/Source/kwsys/Terminal.c +++ b/Source/kwsys/Terminal.c @@ -163,6 +163,7 @@ static const char* kwsysTerminalVT100Names[] = "rxvt-unicode-256color", "screen", "screen-256color", + "screen-256color-bce", "screen-bce", "screen-w", "screen.linux", diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 5921d4d..d53ea09 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 06) +SET(KWSYS_DATE_STAMP_MONTH 07) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 19) +SET(KWSYS_DATE_STAMP_DAY 26) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 2ad9a77..4bf83b7 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1903,8 +1903,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ENDIF() ENDIF() - find_package(Java QUIET) - IF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW + find_package(Java COMPONENTS Development QUIET) + IF(Java_JAVA_EXECUTABLE AND Java_JAVAC_EXECUTABLE AND Java_JAR_EXECUTABLE AND NOT MINGW AND NOT "${CMAKE_TEST_GENERATOR}" MATCHES "Xcode") GET_FILENAME_COMPONENT(JNIPATH ${JAVA_COMPILE} PATH) FIND_FILE(JNI_H jni.h diff --git a/Tests/Java/CMakeLists.txt b/Tests/Java/CMakeLists.txt index b0dfaa5..6a69a24 100644 --- a/Tests/Java/CMakeLists.txt +++ b/Tests/Java/CMakeLists.txt @@ -1,42 +1,9 @@ -cmake_minimum_required (VERSION 2.6) -PROJECT(hello Java) -SET(CMAKE_VERBOSE_MAKEFILE 1) - -IF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}") - MESSAGE("In Source, building Java using ADD_CUSTOM_COMMAND()") - SET(OLD_CUSTOM_COMMAND_WAY 1) -ELSE("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}") - MESSAGE("Out of source, using built-in Java support") - SET(OLD_CUSTOM_COMMAND_WAY ) -ENDIF("${hello_SOURCE_DIR}" STREQUAL "${hello_BINARY_DIR}") - -IF(NOT OLD_CUSTOM_COMMAND_WAY) - - INCLUDE_DIRECTORIES(${hello_SOURCE_DIR} - ${hello_BINARY_DIR} ) - ADD_LIBRARY(hello A.java HelloWorld.java) +project(hello Java) -ELSE(NOT OLD_CUSTOM_COMMAND_WAY) - - ADD_CUSTOM_COMMAND( - OUTPUT ${hello_BINARY_DIR}/A.class - MAIN_DEPENDENCY ${hello_SOURCE_DIR}/A.java - COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/A.java) - ADD_CUSTOM_COMMAND( - OUTPUT ${hello_BINARY_DIR}/HelloWorld.class - MAIN_DEPENDENCY ${hello_SOURCE_DIR}/HelloWorld.java - DEPENDS ${hello_BINARY_DIR}/A.class - COMMAND ${CMAKE_Java_COMPILER} ARGS -classpath . -d ${hello_BINARY_DIR} ${hello_SOURCE_DIR}/HelloWorld.java) - ADD_CUSTOM_COMMAND( - OUTPUT ${hello_BINARY_DIR}/hello.jar - DEPENDS ${hello_BINARY_DIR}/A.class ${hello_BINARY_DIR}/HelloWorld.class - COMMAND ${CMAKE_COMMAND} - ARGS -E chdir ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_Java_ARCHIVE} - -cvf hello.jar *.class) - - ADD_CUSTOM_TARGET(hello_jar ALL - DEPENDS ${hello_BINARY_DIR}/hello.jar) +cmake_minimum_required (VERSION 2.6) +set(CMAKE_VERBOSE_MAKEFILE 1) -ENDIF(NOT OLD_CUSTOM_COMMAND_WAY) +find_package(Java COMPONENTS Development) +include (UseJava) +add_jar(hello A.java HelloWorld.java) diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 0b9380f..3a6b5c4 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -736,3 +736,5 @@ ENDIF(ENABLE_TEST) add_subdirectory(libarchive) #add_subdirectory(tar) #add_subdirectory(cpio) + +install(FILES COPYING DESTINATION ${CMake_DOC_DEST}/cmlibarchive) |