diff --git a/CMakeLists.txt b/CMakeLists.txt index be5a67f72..ea35e212b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ # See the License for more information. #============================================================================= CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) +SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required PROJECT(CMake) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) @@ -418,9 +419,9 @@ ENDIF() # The CMake version number. SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) -SET(CMake_VERSION_PATCH 3) +SET(CMake_VERSION_PATCH 4) SET(CMake_VERSION_TWEAK 0) -#SET(CMake_VERSION_RC 4) +SET(CMake_VERSION_RC 1) # Releases define a tweak level. IF(DEFINED CMake_VERSION_TWEAK) diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in index d5789ede9..0047e68ce 100644 --- a/CTestCustom.cmake.in +++ b/CTestCustom.cmake.in @@ -24,6 +24,8 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION "is not used for resolving any symbol" "Clock skew detected" "remark\\(1209" + "remark: .*LOOP WAS VECTORIZED" + "warning .980: wrong number of actual arguments to intrinsic function .std::basic_" "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF" "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF" "Warning: library was too large for page size.*" diff --git a/ChangeLog.manual b/ChangeLog.manual index c2e2cdf29..bccf4853b 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,311 @@ +Changes in CMake 2.8.4-rc1 (since 2.8.3) +---------------------------------------- +Alex Neundorf (32): + Add support for nasm assembler, patch by Peter Collingbourne (see #10069) + Improve misleading comments. + Add missing copyright headers + We already have 2010, fix copyright year. + Make FindBISON work properly with non-C locales (#11326) + Add support for yasm, a nasm compatible assembler + Use CMAKE_ASM_NASM_FLAGS for nasm instead of FLAGS + Remove trailing whitespace and minor formatting changes for the dot-code + Move the code for collecting targets and libraries into separate functions + Properly insert all targets, also those which don't link to anything. + Generate separate dot files for each target, and a big one with everything. + Move the code for generating dot-files into separate class cmGraphVizWriter + Fix #11421: FindQt3.cmake doesn't honor the REQUIRED keyword + Remove trailing whitespace + Don't enforce VERBOSE makefiles for the CodeBlocks generator + Remove the "early alpha stage" comments about Eclipse and C::B + Don't disable colors in the CodeBlocks generator and minor cleanup. + Some more fixes for nasm support, from Etienne (#10069) + Enable/disable generating graphs depending on the target type + Use std::cout instead of fprintf + Collect targets and libs on demand instead of in the ctor + Exclude targets from the graphviz file based on a regex + Include CMakeDetermineCompilerId in CMakeDetermineASMCompiler.cmake (#11467) + Fix typos in the doc + Add cache var CMAKE_ECLIPSE_MAKE_ARGUMENTS when using the Eclipse generator + Add ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT as a ADVANCED cache variable (#9631) + Fix crash in Eclipse generator with empty project (#11616) + Fix indentation in cmPolicies::ApplyPolicyVersion() + Remove trailing whitespace + Prefer files from CMAKE_ROOT when including from CMAKE_ROOT + Improve documentation and messages for the new CMP0017 + Remove usage of CMAKE_CURRENT_LIST_DIR now that we have CMP0017 + +Alexey Ozeritsky (5): + FindBLAS works in C/C++ projects without Fortran + ACML find fixes (issue 0011219) + find ACML fixes + fix for Fortran-only projects + FindLAPACK works with C/C++ only projects (issue 0009976) + +Andrius Štikonas (1): + Modules: Fix spelling 'becase' -> 'because'. + +Ben Boeckel (25): + Fix parsing of cache variables without a type + Use cmCacheManager to load entries from the cache + Support manual cache entries + Condense parsing of cache entries + Use FPHSA in FindOpenGL + Ignore strerror_r since CMake isn't threaded + Use _POLL_EMUL_H_ instead of HAVE_POLL_FINE + Rename WorkingDirectory test + Add WORKING_DIRECTORY argument to add_test + Add tests for WORKING_DIRECTORY arg to add_test + Rename the project to match the test + Fix header includes for C++ and Visual Studio + Add ctype.h include for toupper() + Flip slashes around on Windows + Use --><-- markers to denote the path + Simplify the _default_cwd derivation + Only test the default cwd with Makefiles + Group adding tests with its properties + Fully specify the path to old-signature add_test + Use iostream to make Borland happy + Check for poll when looking for _POLL_EMUL_H_ + Toss out strerror_r macros + Fix missed _POLL_EMUL_H_ and HAVE_POLL combo + Make TestsWorkingDirectory test a C file + Pass the expected value as the first argument + +Bill Hoffman (17): + Fixes for the OSF operating system build. + Add a fix for the inline keyword on the osf os. + Add a "Contract" test for VTK. The test downloads and builds VTK. + Fix contract test so it is not hard coded to the vtk542 test. + Fix incremental linking for VS2010 with nmake or make. + Change cpack run and verify script to work with multi-config generators. + Fix vs2010 project generation error when HEADER_FILE_ONLY is set. + Add more documentation for LANGUAGE property. + Add flags to resource builds on vs 2010 with a test. + Disable incremental testing for this test, it crashes vs9 linker. + Only run resource test for MSVC compilers. + Add support for windows resources with mingw/msys. + Add support for windres to cygwin. + Add testing for windows resources for mingw/msys/cygwin and remove for watcom. + Enable resource building with the intel compiler on windows. + Add support for source files in custom targets for VS 10 (Bug#11330). + Change the nightly tests to build from the nightly branch and not next. + +Brad King (90): + Store direct dependencies in solutions for VS >= 8 + BUG: Fix compiler flag test for non-English MSVC (#11336) + Document custom command behavior without DEPENDS (#11407) + Consolidate duplicate link rule make dependency code + Define LINK_DEPENDS target property (#11406) + KWSys: Teach SystemInformation about WinXP Pro and Win7 + Fix Intel .vfproj SubSystem attribute values + Set Intel .vfproj RuntimeLibrary attribute + Create Fortran info variables for .mod behavior + Teach CMake about Cray C, C++, and Fortran compilers + Speedup find_* commands (#11412) + Prefer non-empty prefixes when matching lib names (#11468) + Record edge type in global dependency graph + Use modern global dependency graph for VS < 8 deps + Allow add_dependencies() on imported targets (#10395) + Pass Mac linker flag through PGI compiler using "-Wl," + Modernize FindITK module (#11494) + Fix find_* argument parsing crash (#11513) + Skip VS <= 7.1 dependency analysis for VS >= 8 + Enable 64-bit tools with VS 2010 Express (#9981, #10722) + KWSys: Associate installed library with an EXPORT + Fix try_compile RemoveFile anti-virus loop (#11503) + Fix Fortran .mod timestamps with Cray compiler + Make Fortran $obj.provides.build targets not .PHONY + Honor custom command dependencies on imported targets (#10395) + Improve signature of cmLocalGenerator::GetRealDependency + Skip file-level dependencies on custom targets (#11332) + Simplify VS generator ConstructScript interface + Factor out common custom command generator + Remove cmLocalGenerator::GetRealLocation + KWSys: Remove realpath from SystemTools::GetPath (#10335) + Fix parallel "make install" of CMake itself + CTest: Fix ctest_sleep documentation (#11554) + Fix soname in cross-compiled targets with Mac host (#11547) + Detect object files in implicit link information + Allow Fortran platform files to set empty values + Recognize the NAG Fortran compiler + Add NAG Fortran compiler information files + FortranCInterface: Recognize NAG Fortran module symbols + Remove unused variable "rootdir" in VS generators + Avoid msbuild idiosyncrasy that builds multiple configs (#11594) + Remove unused parameter "root" in some VS generator methods + Fix dependency tracing of INSTALL and PACKAGE (#11598) + Remove unused GLOBAL_TARGET generation code + KWSys: Use EXPORT name only if installing library + Write full version into try_compile CMakeLists + KWSys: Do not mangle UNC paths in ConvertToUnixOutputPath (#10206) + Normalize add_custom_command OUTPUT names (#10485) + Make link rule depend on ".def" file (#11014) + Document target_link_libraries target scope (#11058) + Record backtrace in cmCustomCommand + Factor generator expression docs out of add_test + Factor per-config sample targets out of 'Testing' test + Optionally suppress errors in cmGeneratorExpression + Record set of targets used in cmGeneratorExpression + Introduce "generator expression" syntax to custom commands (#11209) + CTest: Fix test DEPEND cycle detection + Make Intel defines consistent with MSVC on Windows (#9904) + CTest: Fix line-too-long style in DEPEND cycle error + Detect Fortran target architecture on Windows + Modernize Intel compiler info on Windows + Remove unused old-style g++ info file + CheckCCompilerFlag: Strict signature of 'main' (#11615) + Warn in find(GLOB) docs about bad use case (#11617) + Remove call to SystemTools::GetMaximumFilePathLength + Xcode: Generate native 3.2 projects + Declare min CMake version in --system-information project + Cygwin: Fix tests to check CYGWIN instead of WIN32 + Cygwin: Do not define 'WIN32' (#10122) + Revert "Remove unused parameter "root" in some VS generator methods" + Revert "Avoid msbuild idiosyncrasy that builds multiple configs" (#11633) + Avoid msbuild ".\" idiosyncrasy that builds multiple configs (#11594) + Mark CustomCommand test perconfig.out as SYMBOLIC + CTest: Factor out duplicate Git author/committer code + KWSys: Avoid buffer overflow in SystemInformation (#11018) + Fix sentence break in add_test documentation + Pass Mac linker flag through all compilers with -Wl, + KWSys: Avoid passing string literal as char* + Avoid passing string literal to char* type + Fix constness in compiler id detection + Build enable_language command during bootstrap + Map multiple /FI flags for VS < 10 (#11649) + KWSys: Remove useless include (#11648) + Allow users to specify defaults for unset policies + ccmake: Use LSB 4.0 curses API conditionally + CTest: Do not truncate UTF-8 test output too early (#10656) + ccmake: Use LSB 4.0 getmaxyx conditionally + Allow platform files to set large archive rules (#11674) + Document reading LOCATION early as undefined (#11671) + Document reading LOCATION_ early as undefined (#11671) + +Brian Bassett (1): + VS: Fix linking of Fortran-only DLL projects (#10803) + +Campbell Barton (1): + Honor RULE_MESSAGES property for build target messages + +Chuck Atkins (1): + CTest: Teach launcher to ignore empty/no-op make commands + +Clinton Stimpson (11): + Fix regex for moc includes when looking for frameworks. + cmake-gui: use BundleUtilities in place of custom script. + Fix regression in 2dae2f1 which added find of Qt imports dir. + Force cmake to run again when qrc dependency scanning needs to happen. + Fix regression to allow specifying a CMakeCache.txt file on the command line. + BundleUtilities: only do rpath strip on copied prerequisites. + Fix build issues cross compiling with static Qt. + CTest: multiple ctest_test calls w/LABEL regexs (#11487) + cmake-gui: always enable generate button. + allow absolute paths for dbus interface. + Add support for using static/dynamic Qt plugins. + +Craig Scott (1): + ccmake: Port for LSB 4.0 (#11648) + +Dave Abrahams (1): + FindPerlLibs: Fix for Mac locally applied patches + +David Cole (31): + Add a contract test for building the CSE. + Enable overriding contract test timeout values. + Update tag in the Contracts/cse-snapshot test. + Make HTML test fail when --nonet arg is not available. + Begin post-2.8.3 development + No CMake.HTML test if xmllint has no --nonet. + Suppress "loop was vectorized" "warnings." + Add contract test for Trilinos 10.6.1 snapshot. + Honor FOLDER on include_external_msproject targets (#11436) + Correct misspelling in error message text. + BundleUtilities: error if fixup_bundle_item called on non-embedded item + VS10: stop build on custom command error (#11533) + CPack: look for makensis in the PATH (#8210) + VS10: avoid warning, no nologo when verbose (#10587) + Use m prefix in shorttag value to indicate "md5 of tarball" + Establish pass criteria for the Trilinos contract test. + Suppress erroneous warnings from Intel compiler + Avoid running CMake.Install test simultaneously with other tests + VS10: Finish Midl support (#11461) + Prohibit space in HOME value for VSMidl test. + KWSys: Fix CPU speed calculations (#9963) + KWSys: Retrieve QNX specific memory and processor info (#11329) + Improve build error detection. + VSMidl Test: Use correct include_directories with VS6 (#11461) + Add PATH_SUFFIXES for finding git. + ExternalProject: Avoid bleed-through output when logging. + Fix WOW64 registry mode on Windows 2000 (#10759) + ExternalProject: Replace location tags in CMAKE_CACHE_ARGS + CPack: Detect more URLs in CPACK_NSIS_MENU_LINKS (#10644) + KWSys: Fix WOW64 registry mode on Windows 2000 (#10759) + CPack: Add CPACK_NSIS_INSTALL_ROOT variable (#9148) + +Eric NOULARD (13): + CPackRPM add basic component support to CPackRPM + CPack fix kwstyle breakage and make CPackRPM backward compatible + CPack backward compatibility fix 2.8.3-2.8.2 (bug 11452) + CPack Fix KWStyle error + CPack Honor CPACK_MONOLITHIC_INSTALL at CPack time too + CPack use IsOn when it's better than IsSet + CPackRPM fix bug 0011595 : Can't generate RPMs (on FC11...) + CPack new tests for component install + CPack Default component test for ZIP should be OK + CPackTest spit out more output in case of failure + Arrange output in a better way + Precise the project config type when invoking cpack + CPackSTGZ quote here-doc, fix bug10518 + +Kai Wasserbäch (1): + FindTCL: Fix TCL and TK version variable references (#11528) + +Marcus D. Hanwell (5): + BUG 11451 - pass CMAKE_EXTRA_GENERATOR down. + Added CMAKE_CACHE_ARGS to ExternalProject. + Escape file write expansion, and build up lists. + Fixed bug where last entry would be lost. + Python additional version support, bug #10279. + +Matthias Kretz (1): + Inline help in vim with vertical split. + +Mike McQuaid (6): + Fix incorrect variable documentation (#11127) + Add variable for InstallRequiredSystemLibraries dir (#11140) + InstallRequiredSystemLibraries debug-only (#11141) + Allow NSIS package or uninstall icon (#11143) + Add CPACK_NSIS_EXECUTABLES_DIRECTORY (#7828) + Add CPack NSIS MUI_FINISHPAGE_RUN support (#11144) + +Philip Lowman (8): + 11363: FindBoost.cmake fails to find debug libraries in tagged layout install + 11429: FindGTK2 does not find libraries built for Visual Studio 2010 + 11430: FindBullet doesn't find header files installed by Bullet >= 2.77 + 11384: FindCxxTest now includes test code in VS project + [patch] Add Boost 1.45 to search, simplify a check removing VERSION_LESS + Add Boost 1.46 + Fix spelling BOOST_LIBRARYDIR message. Add error for common misspellings. + Lowercase all function names and improve consistency + +Rolf Eike Beer (2): + allow STRING(SUBSTRING) work with length -1 as "rest of the string" + Add the WORKING_DIRECTORY property to tests + +Wojciech Migda (1): + Recognize the Texas Instruments DSP compiler (#11645) + +Yaakov Selkowitz (2): + Cygwin: Use 'cyg' prefix for module DLLs (#10122) + Cygwin: Fix release script libncurses search patterns (#10766) + +Zach Mullen (4): + Remove debugging message from parallel ctest + CTest git update should pass the committer as well as the author + Support explicitly set test costs in non-parallel testing. + Test TIMEOUT property explicitly set to zero should be honored + No changes in CMake 2.8.3 since 2.8.3-rc4. Changes in CMake 2.8.3-rc4 (since 2.8.3-rc3) diff --git a/Docs/cmake-help.vim b/Docs/cmake-help.vim new file mode 100644 index 000000000..17cfa838e --- /dev/null +++ b/Docs/cmake-help.vim @@ -0,0 +1,21 @@ +nmap ,hc :call OpenCmakeHelp() + +function! OpenCmakeHelp() + let s = getline( '.' ) + let i = col( '.' ) - 1 + while i > 0 && strpart( s, i, 1 ) =~ '[A-Za-z0-9_]' + let i = i - 1 + endwhile + while i < col('$') && strpart( s, i, 1 ) !~ '[A-Za-z0-9_]' + let i = i + 1 + endwhile + let start = match( s, '[A-Za-z0-9_]\+', i ) + let end = matchend( s, '[A-Za-z0-9_]\+', i ) + let ident = strpart( s, start, end - start ) + execute "vertical new" + execute "%!cmake --help-command ".ident + set nomodified + set readonly +endfunction + +autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in nmap :call OpenCmakeHelp() diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index c7ead5bd0..44f2c202e 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -27,6 +27,11 @@ # drag-n-drop copied to another machine and run on that machine as long as all # of the system libraries are compatible. # +# If you pass plugins to fixup_bundle as the libs parameter, you should install +# them or copy them into the bundle before calling fixup_bundle. The "libs" +# parameter is a list of libraries that must be fixed up, but that cannot be +# determined by otool output analysis. (i.e., plugins) +# # Gather all the keys for all the executables and libraries in a bundle, and # then, for each key, copy each prerequisite into the bundle. Then fix each one # up according to its own list of prerequisites. @@ -112,6 +117,13 @@ # _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to # an "@executable_path" style reference.) # +# This function requires that the resolved_embedded_item be "inside" the bundle +# already. In other words, if you pass plugins to fixup_bundle as the libs +# parameter, you should install them or copy them into the bundle before +# calling fixup_bundle. The "libs" parameter is a list of libraries that must +# be fixed up, but that cannot be determined by otool output analysis. (i.e., +# plugins) +# # Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM # value. # @@ -472,11 +484,11 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item) else() #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}") execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}") + if(UNIX AND NOT APPLE) + file(RPATH_REMOVE FILE "${resolved_embedded_item}") + endif(UNIX AND NOT APPLE) endif() - if(UNIX AND NOT APPLE) - file(RPATH_REMOVE FILE "${resolved_embedded_item}") - endif(UNIX AND NOT APPLE) endfunction(copy_resolved_item_into_bundle) @@ -514,11 +526,11 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}") endif() endif() + if(UNIX AND NOT APPLE) + file(RPATH_REMOVE FILE "${resolved_embedded_item}") + endif(UNIX AND NOT APPLE) endif() - if(UNIX AND NOT APPLE) - file(RPATH_REMOVE FILE "${resolved_embedded_item}") - endif(UNIX AND NOT APPLE) endfunction(copy_resolved_framework_into_bundle) @@ -527,6 +539,24 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # get_item_key("${resolved_embedded_item}" ikey) + # Ensure the item is "inside the .app bundle" -- it should not be fixed up if + # it is not in the .app bundle... Otherwise, we'll modify files in the build + # tree, or in other varied locations around the file system, with our call to + # install_name_tool. Make sure that doesn't happen here: + # + get_dotapp_dir("${exepath}" exe_dotapp_dir) + string(LENGTH "${exe_dotapp_dir}/" exe_dotapp_dir_length) + string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring) + if(NOT "${exe_dotapp_dir}/" STREQUAL "${item_substring}") + message(" exe_dotapp_dir/='${exe_dotapp_dir}/'") + message(" item_substring='${item_substring}'") + message(" resolved_embedded_item='${resolved_embedded_item}'") + message("") + message("Install or copy the item into the bundle before calling fixup_bundle") + message("") + message(FATAL_ERROR "cannot fixup an item that is not in the bundle...") + endif() + set(prereqs "") get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}") diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake new file mode 100644 index 000000000..9da7d306c --- /dev/null +++ b/Modules/CMakeASM_NASMInformation.cmake @@ -0,0 +1,46 @@ + +#============================================================================= +# Copyright 2010 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.) + +# support for the nasm assembler + +set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm) + +if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT) + if(WIN32) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32) + endif() + elseif(APPLE) + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho) + endif() + else() + if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8) + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) + else() + SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf) + endif() + endif() +endif() + +set(CMAKE_ASM_NASM_COMPILE_OBJECT " -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o ") + +# Load the generic ASMInformation file: +set(ASM_DIALECT "_NASM") +include(CMakeASMInformation) +set(ASM_DIALECT) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index accda3257..c7778fbdc 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -42,6 +42,12 @@ #elif defined(__PATHSCALE__) # define COMPILER_ID "PathScale" +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI_DSP" + #elif defined(__GNUC__) # define COMPILER_ID "GNU" @@ -85,7 +91,7 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@ diff --git a/Modules/CMakeCInformation.cmake b/Modules/CMakeCInformation.cmake index 86a824a76..668119fd6 100644 --- a/Modules/CMakeCInformation.cmake +++ b/Modules/CMakeCInformation.cmake @@ -164,9 +164,15 @@ ENDIF(NOT CMAKE_C_CREATE_SHARED_MODULE) # Create a static archive incrementally for large object file counts. # If CMAKE_C_CREATE_STATIC_LIBRARY is set it will override these. -SET(CMAKE_C_ARCHIVE_CREATE " cr ") -SET(CMAKE_C_ARCHIVE_APPEND " r ") -SET(CMAKE_C_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_C_ARCHIVE_CREATE) + SET(CMAKE_C_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_C_ARCHIVE_APPEND) + SET(CMAKE_C_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_C_ARCHIVE_FINISH) + SET(CMAKE_C_ARCHIVE_FINISH " ") +ENDIF() # compile a C file into an object file IF(NOT CMAKE_C_COMPILE_OBJECT) diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 4a32823f8..2ff227aa9 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -44,6 +44,12 @@ #elif defined(__PATHSCALE__) # define COMPILER_ID "PathScale" +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI_DSP" + #elif defined(__GNUC__) # define COMPILER_ID "GNU" @@ -76,7 +82,7 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@ diff --git a/Modules/CMakeCXXInformation.cmake b/Modules/CMakeCXXInformation.cmake index 680f8fdbd..163a7eff9 100644 --- a/Modules/CMakeCXXInformation.cmake +++ b/Modules/CMakeCXXInformation.cmake @@ -241,9 +241,15 @@ ENDIF(NOT CMAKE_CXX_CREATE_SHARED_MODULE) # Create a static archive incrementally for large object file counts. # If CMAKE_CXX_CREATE_STATIC_LIBRARY is set it will override these. -SET(CMAKE_CXX_ARCHIVE_CREATE " cr ") -SET(CMAKE_CXX_ARCHIVE_APPEND " r ") -SET(CMAKE_CXX_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_CREATE) + SET(CMAKE_CXX_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_APPEND) + SET(CMAKE_CXX_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_CXX_ARCHIVE_FINISH) + SET(CMAKE_CXX_ARCHIVE_FINISH " ") +ENDIF() # compile a C++ file into an object file IF(NOT CMAKE_CXX_COMPILE_OBJECT) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 06dd6b86f..7a443e0b9 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -64,7 +64,11 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler") + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") + INCLUDE(CMakeDetermineCompilerId) CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake new file mode 100644 index 000000000..d184c0a81 --- /dev/null +++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake @@ -0,0 +1,27 @@ + +#============================================================================= +# Copyright 2010 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.) + +# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible + +SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm) + +IF(NOT CMAKE_ASM_NASM_COMPILER) + FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm + "$ENV{ProgramFiles}/NASM") +ENDIF(NOT CMAKE_ASM_NASM_COMPILER) + +# Load the generic DetermineASM compiler file with the DIALECT set properly: +SET(ASM_DIALECT "_NASM") +INCLUDE(CMakeDetermineASMCompiler) +SET(ASM_DIALECT) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index d6df30590..ed0b6fbff 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -64,7 +64,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src) AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" # Skip this with Xcode for now. AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode) - CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log) + CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log + "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Parsed ${lang} implicit link information from above output:\n${log}\n\n") ENDIF() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 03ddd78eb..53558866f 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -169,6 +169,9 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") + LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V") + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler") # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) @@ -215,6 +218,10 @@ ENDIF(NOT CMAKE_Fortran_COMPILER_ID_RUN) INCLUDE(CMakeFindBinUtils) +IF(MSVC_Fortran_ARCHITECTURE_ID) + SET(SET_MSVC_Fortran_ARCHITECTURE_ID + "SET(MSVC_Fortran_ARCHITECTURE_ID ${MSVC_Fortran_ARCHITECTURE_ID})") +ENDIF() # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index 094b8937b..8e085af7a 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -54,6 +54,12 @@ ENDIF(NOT CMAKE_RC_COMPILER) MARK_AS_ADVANCED(CMAKE_RC_COMPILER) +GET_FILENAME_COMPONENT(_CMAKE_RC_COMPILER_NAME_WE ${CMAKE_RC_COMPILER} NAME_WE) +IF(_CMAKE_RC_COMPILER_NAME_WE STREQUAL "windres") + SET(CMAKE_RC_OUTPUT_EXTENSION .obj) +ELSE() + SET(CMAKE_RC_OUTPUT_EXTENSION .res) +ENDIF() # configure variables set in this file for fast reload later on CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index 836e4c9bf..fbcdc9841 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -17,6 +17,12 @@ FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable") +# This variable is used by the Eclipse generator and appended to the make invocation commands. +SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j to get parallel builds") + +# This variable is used by the Eclipse generator in out-of-source builds only. +SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR") +MARK_AS_ADVANCED(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT) # The Eclipse generator needs to know the standard include path # so that Eclipse ca find the headers at runtime and parsing etc. works better diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 555865195..146a6f2c2 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -2,6 +2,7 @@ SET(CMAKE_Fortran_COMPILER "@CMAKE_Fortran_COMPILER@") SET(CMAKE_Fortran_COMPILER_ARG1 "@CMAKE_Fortran_COMPILER_ARG1@") SET(CMAKE_Fortran_COMPILER_ID "@CMAKE_Fortran_COMPILER_ID@") SET(CMAKE_Fortran_PLATFORM_ID "@CMAKE_Fortran_PLATFORM_ID@") +@SET_MSVC_Fortran_ARCHITECTURE_ID@ SET(CMAKE_AR "@CMAKE_AR@") SET(CMAKE_RANLIB "@CMAKE_RANLIB@") SET(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 107470cd0..858473149 100644 --- a/Modules/CMakeFortranCompilerId.F.in +++ b/Modules/CMakeFortranCompilerId.F.in @@ -6,6 +6,8 @@ PRINT *, 'INFO:compiler[Intel]' #elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) PRINT *, 'INFO:compiler[SunPro]' +#elif defined(_CRAYFTN) + PRINT *, 'INFO:compiler[Cray]' #elif defined(__G95__) PRINT *, 'INFO:compiler[G95]' #elif defined(__PATHSCALE__) @@ -106,5 +108,14 @@ ! SGI preprocessor which produces both the __sgi and else blocks. # endif PRINT *, 'INFO:platform[]' +#endif +#if defined(_WIN32) && (defined(__INTEL_COMPILER) || defined(__ICC)) +# if defined(_M_IA64) + PRINT *, 'INFO:arch[IA64]' +# elif defined(_M_X64) || defined(_M_AMD64) + PRINT *, 'INFO:arch[x64]' +# elif defined(_M_IX86) + PRINT *, 'INFO:arch[X86]' +# endif #endif END diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake index f6a52c6eb..d18353a08 100644 --- a/Modules/CMakeFortranInformation.cmake +++ b/Modules/CMakeFortranInformation.cmake @@ -67,29 +67,29 @@ SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1) # Create a set of shared library variable specific to Fortran # For 90% of the systems, these are the same flags as the C versions # so if these are not set just copy the flags from the c version -IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS}) -ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG}) -ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG) SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG}) @@ -100,25 +100,25 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG) ENDIF() # repeat for modules -IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS) SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS}) -ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP}) -ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP) +ENDIF() -IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG}) -ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG) +ENDIF() IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH) SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH}) @@ -163,9 +163,15 @@ ENDIF(NOT CMAKE_Fortran_CREATE_SHARED_MODULE) # Create a static archive incrementally for large object file counts. # If CMAKE_Fortran_CREATE_STATIC_LIBRARY is set it will override these. -SET(CMAKE_Fortran_ARCHIVE_CREATE " cr ") -SET(CMAKE_Fortran_ARCHIVE_APPEND " r ") -SET(CMAKE_Fortran_ARCHIVE_FINISH " ") +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_CREATE) + SET(CMAKE_Fortran_ARCHIVE_CREATE " cr ") +ENDIF() +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_APPEND) + SET(CMAKE_Fortran_ARCHIVE_APPEND " r ") +ENDIF() +IF(NOT DEFINED CMAKE_Fortran_ARCHIVE_FINISH) + SET(CMAKE_Fortran_ARCHIVE_FINISH " ") +ENDIF() # compile a Fortran file into an object file IF(NOT CMAKE_Fortran_COMPILE_OBJECT) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index defdb472d..5405bda58 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -16,7 +16,7 @@ # This is used internally by CMake and should not be included by user # code. -function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) +function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex) set(implicit_libs_tmp "") set(implicit_dirs_tmp) set(log "") @@ -59,6 +59,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var) # Unix library full path. list(APPEND implicit_libs_tmp ${arg}) set(log "${log} arg [${arg}] ==> lib [${arg}]\n") + elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$" + AND obj_regex AND "${arg}" MATCHES "${obj_regex}") + # Object file full path. + list(APPEND implicit_libs_tmp ${arg}) + set(log "${log} arg [${arg}] ==> obj [${arg}]\n") elseif("${arg}" MATCHES "^-Y(P,)?") # Sun search path. string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index e20348aac..cb3f40a1f 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -83,7 +83,7 @@ #endif /* For windows compilers MSVC and Intel we can determine - the architecture of the compiler being used. This is becase + the architecture of the compiler being used. This is because the compilers do not have flags that can change the architecture, but rather depend on which compiler is being used */ @@ -109,6 +109,6 @@ getting matched. Store it in a pointer rather than an array because some compilers will just produce instructions to fill the array rather than assigning a pointer to a static array. */ -char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; -char* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; diff --git a/Modules/CMakeRCCompiler.cmake.in b/Modules/CMakeRCCompiler.cmake.in index 93bc8502e..83428e2eb 100644 --- a/Modules/CMakeRCCompiler.cmake.in +++ b/Modules/CMakeRCCompiler.cmake.in @@ -2,5 +2,5 @@ SET(CMAKE_RC_COMPILER "@CMAKE_RC_COMPILER@") SET(CMAKE_RC_COMPILER_ARG1 "@CMAKE_RC_COMPILER_ARG1@") SET(CMAKE_RC_COMPILER_LOADED 1) SET(CMAKE_RC_SOURCE_FILE_EXTENSIONS rc) -SET(CMAKE_RC_OUTPUT_EXTENSION .res) +SET(CMAKE_RC_OUTPUT_EXTENSION @CMAKE_RC_OUTPUT_EXTENSION@) SET(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake index 3b7a74f18..581ad0c23 100644 --- a/Modules/CMakeTestASM-ATTCompiler.cmake +++ b/Modules/CMakeTestASM-ATTCompiler.cmake @@ -13,10 +13,10 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that that selected ASM-ATT compiler can actually compile -# and link the most basic of programs. If not, a fatal error -# is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM-ATT "compiler" works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. SET(ASM_DIALECT "-ATT") INCLUDE(CMakeTestASMCompiler) diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake index 54def8136..56cf3325e 100644 --- a/Modules/CMakeTestASMCompiler.cmake +++ b/Modules/CMakeTestASMCompiler.cmake @@ -13,10 +13,11 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that that selected ASM compiler can actually compile -# and link the most basic of programs. If not, a fatal error -# is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM compiler works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER) SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS 1 CACHE INTERNAL "") ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER) diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake index 84ca98f43..8369b942c 100644 --- a/Modules/CMakeTestASM_MASMCompiler.cmake +++ b/Modules/CMakeTestASM_MASMCompiler.cmake @@ -13,10 +13,10 @@ # License text for the above reference.) # This file is used by EnableLanguage in cmGlobalGenerator to -# determine that the selected ASM_MASM "compiler" (should be masm or masm64) -# can actually "compile" and link the most basic of programs. If not, a -# fatal error is set and cmake stops processing commands and will not generate -# any makefiles or projects. +# determine that the selected ASM_MASM "compiler" (should be masm or masm64) +# works. For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. SET(ASM_DIALECT "_MASM") INCLUDE(CMakeTestASMCompiler) diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake new file mode 100644 index 000000000..a5e2bea0a --- /dev/null +++ b/Modules/CMakeTestASM_NASMCompiler.cmake @@ -0,0 +1,23 @@ + +#============================================================================= +# Copyright 2010 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.) + +# This file is used by EnableLanguage in cmGlobalGenerator to +# determine that the selected ASM_NASM "compiler" works. +# For assembler this can only check whether the compiler has been found, +# because otherwise there would have to be a separate assembler source file +# for each assembler on every architecture. + +SET(ASM_DIALECT "_NASM") +INCLUDE(CMakeTestASMCompiler) +SET(ASM_DIALECT) diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in index 3b50e74ee..dee576fb5 100755 --- a/Modules/CPack.STGZ_Header.sh.in +++ b/Modules/CPack.STGZ_Header.sh.in @@ -80,7 +80,7 @@ then if [ "x${cpack_skip_license}x" != "xTRUEx" ] then - more << ____cpack__here_doc____ + more << '____cpack__here_doc____' @CPACK_RESOURCE_FILE_LICENSE_CONTENT@ ____cpack__here_doc____ echo diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 7033e314a..797ee5788 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -210,6 +210,11 @@ # CPACK_PACKAGE_INSTALL_REGISTRY_KEY - Registry key used when # installing this project. # +# CPACK_NSIS_INSTALL_ROOT - The default installation directory presented +# to the end user by the NSIS installer is under this root dir. The full +# directory presented to the end user is: +# ${CPACK_NSIS_INSTALL_ROOT}/${CPACK_PACKAGE_INSTALL_DIRECTORY} +# # CPACK_NSIS_MUI_ICON - The icon file (.ico) for the generated # install program. # @@ -257,6 +262,14 @@ # CPACK_NSIS_DELETE_ICONS_EXTRA -Additional NSIS commands to # uninstall start menu shortcuts. # +# CPACK_NSIS_EXECUTABLES_DIRECTORY - Creating NSIS start menu links +# assumes that they are in 'bin' unless this variable is set. +# For example, you would set this to 'exec' if your executables are +# in an exec directory. +# +# CPACK_NSIS_MUI_FINISHPAGE_RUN - Specify an executable to add an option +# to run on the finish page of the NSIS installer. +# # The following variable is specific to installers build on Mac OS X # using PackageMaker: # @@ -777,6 +790,11 @@ IF(${__cpack_system_name} MATCHES Windows) ENDIF(${__cpack_system_name} MATCHES Windows) cpack_set_if_not_set(CPACK_SYSTEM_NAME "${__cpack_system_name}") +# Root dir: default value should be the string literal "$PROGRAMFILES" +# for backwards compatibility. Projects may set this value to anything. +set(__cpack_root_default "$PROGRAMFILES") +cpack_set_if_not_set(CPACK_NSIS_INSTALL_ROOT "${__cpack_root_default}") + # -..--. cpack_set_if_not_set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index e2d788029..026c45a6f 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -331,7 +331,7 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE) ENDIF(CPACK_RPM_COMPRESSION_TYPE) if(CPACK_PACKAGE_RELOCATABLE) - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) + set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) endif(CPACK_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_RELOCATABLE) if(CPACK_RPM_PACKAGE_DEBUG) @@ -453,6 +453,17 @@ SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") #STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") + +# Are we packaging components ? +IF(CPACK_RPM_PACKAGE_COMPONENT) + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}") +ELSE(CPACK_RPM_PACKAGE_COMPONENT) + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "") + SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "") + SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}") +ENDIF(CPACK_RPM_PACKAGE_COMPONENT) # Use files tree to construct files command (spec file) # We should not forget to include symlinks (thus -o -type l) # We must remove the './' due to the local search and escape the @@ -460,10 +471,10 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") # Then we must authorize any man pages extension (adding * at the end) # because rpmbuild may automatically compress those files EXECUTE_PROCESS(COMMAND find -type f -o -type l - COMMAND sed {s:.*/man.*/.*:&*:} - COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/} - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" - OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) + COMMAND sed {s:.*/man.*/.*:&*:} + COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/} + WORKING_DIRECTORY "${WDIR}" + OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES) if (CPACK_ABSOLUTE_DESTINATION_FILES) IF(CPACK_RPM_PACKAGE_DEBUG) @@ -494,7 +505,7 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES) endif(CPACK_ABSOLUTE_DESTINATION_FILES) # The name of the final spec file to be used by rpmbuild -SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") +SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec") # Print out some debug information if we were asked for that IF(CPACK_RPM_PACKAGE_DEBUG) @@ -517,7 +528,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG) IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in "# -*- rpm-spec -*- -BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@ +BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ Name: \@CPACK_RPM_PACKAGE_NAME\@ Version: \@CPACK_RPM_PACKAGE_VERSION\@ @@ -555,10 +566,9 @@ mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" %install if [ -e $RPM_BUILD_ROOT ]; then - mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT -else - mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT + rm -rf $RPM_BUILD_ROOT fi +mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT %clean @@ -608,15 +618,15 @@ IF(RPMBUILD_EXECUTABLE) # Now call rpmbuild using the SPECFILE EXECUTE_PROCESS( COMMAND "${RPMBUILD_EXECUTABLE}" -bb - --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" + --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" "${CPACK_RPM_BINARY_SPECFILE}" - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" + ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err" + OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") IF(CPACK_RPM_PACKAGE_DEBUG) MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err") - MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err") + MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out") ENDIF(CPACK_RPM_PACKAGE_DEBUG) ELSE(RPMBUILD_EXECUTABLE) IF(ALIEN_EXECUTABLE) diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake index 0068617bb..a03b64d56 100644 --- a/Modules/CheckCCompilerFlag.cmake +++ b/Modules/CheckCCompilerFlag.cmake @@ -7,7 +7,7 @@ # that can modify the build. #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2010 Kitware, Inc. # Copyright 2006 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); @@ -25,10 +25,11 @@ INCLUDE(CheckCSourceCompiles) MACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT) SET(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}") SET(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}") - CHECK_C_SOURCE_COMPILES("int main() { return 0;}" ${_RESULT} + CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${_RESULT} # Some compilers do not fail with a bad flag FAIL_REGEX "unrecognized .*option" # GNU FAIL_REGEX "ignoring unknown option" # MSVC + FAIL_REGEX "warning D9002" # MSVC, any lang FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/CheckCXXCompilerFlag.cmake b/Modules/CheckCXXCompilerFlag.cmake index d8e471548..788bf35b4 100644 --- a/Modules/CheckCXXCompilerFlag.cmake +++ b/Modules/CheckCXXCompilerFlag.cmake @@ -7,7 +7,7 @@ # modify the build. #============================================================================= -# Copyright 2006-2009 Kitware, Inc. +# Copyright 2006-2010 Kitware, Inc. # Copyright 2006 Alexander Neundorf # # Distributed under the OSI-approved BSD License (the "License"); @@ -29,6 +29,7 @@ MACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT) # Some compilers do not fail with a bad flag FAIL_REGEX "unrecognized .*option" # GNU FAIL_REGEX "ignoring unknown option" # MSVC + FAIL_REGEX "warning D9002" # MSVC, any lang FAIL_REGEX "[Uu]nknown option" # HP FAIL_REGEX "[Ww]arning: [Oo]ption" # SunPro FAIL_REGEX "command option .* is not recognized" # XL diff --git a/Modules/Compiler/Cray-C.cmake b/Modules/Compiler/Cray-C.cmake new file mode 100644 index 000000000..675560c2a --- /dev/null +++ b/Modules/Compiler/Cray-C.cmake @@ -0,0 +1 @@ +set(CMAKE_C_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/Cray-CXX.cmake b/Modules/Compiler/Cray-CXX.cmake new file mode 100644 index 000000000..9fb191c75 --- /dev/null +++ b/Modules/Compiler/Cray-CXX.cmake @@ -0,0 +1 @@ +set(CMAKE_CXX_VERBOSE_FLAG "-v") diff --git a/Modules/Compiler/Cray-Fortran.cmake b/Modules/Compiler/Cray-Fortran.cmake new file mode 100644 index 000000000..4f45176d2 --- /dev/null +++ b/Modules/Compiler/Cray-Fortran.cmake @@ -0,0 +1,4 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-v") +set(CMAKE_Fortran_MODOUT_FLAG -em) +set(CMAKE_Fortran_MODDIR_FLAG -J) +set(CMAKE_Fortran_MODDIR_DEFAULT .) diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake new file mode 100644 index 000000000..b68c47994 --- /dev/null +++ b/Modules/Compiler/NAG-Fortran.cmake @@ -0,0 +1,32 @@ +# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files. +if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED) + message(STATUS "Detecting NAG Fortran directory") + # Run with -dryrun to see sample "link" line. + execute_process( + COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun + OUTPUT_VARIABLE _dryrun + ERROR_VARIABLE _dryrun + ) + # Match an object file. + string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}") + if(_nag_obj) + # Parse object directory and convert to a regex. + string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}") + string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}") + set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Detecting NAG Fortran directory with -dryrun found\n" + " object: ${_nag_obj}\n" + " directory: ${_nag_dir}\n" + " regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n" + "from output:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}") + else() + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n") + message(STATUS "Detecting NAG Fortran directory - failed") + endif() +endif() + +set(CMAKE_Fortran_MODDIR_FLAG "-mdir ") +set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC") diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 997164a8e..3de6b7e68 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -32,6 +32,7 @@ # [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable # [CMAKE_GENERATOR gen] # Specify generator for native build # [CMAKE_ARGS args...] # Arguments to CMake command line +# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on # #--Build step----------------- # [BINARY_DIR dir] # Specify build dir location # [BUILD_COMMAND cmd...] # Command to drive the native build @@ -550,6 +551,66 @@ function(_ep_set_directories name) endfunction(_ep_set_directories) +# IMPORTANT: this MUST be a macro and not a function because of the +# in-place replacements that occur in each ${var} +# +macro(_ep_replace_location_tags target_name) + set(vars ${ARGN}) + foreach(var ${vars}) + if(${var}) + foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR) + get_property(val TARGET ${target_name} PROPERTY _EP_${dir}) + string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}") + endforeach() + endif() + endforeach() +endmacro() + + +function(_ep_write_initial_cache target_name script_filename args) + # Write out values into an initial cache, that will be passed to CMake with -C + set(script_initial_cache "") + set(regex "^([^:]+):([^=]+)=(.*)$") + set(setArg "") + foreach(line ${args}) + if("${line}" MATCHES "^-D") + if(setArg) + # This is required to build up lists in variables, or complete an entry + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(script_initial_cache "${script_initial_cache}\n${setArg}") + set(accumulator "") + set(setArg "") + endif() + string(REGEX REPLACE "^-D" "" line ${line}) + if("${line}" MATCHES "${regex}") + string(REGEX MATCH "${regex}" match "${line}") + set(name "${CMAKE_MATCH_1}") + set(type "${CMAKE_MATCH_2}") + set(value "${CMAKE_MATCH_3}") + set(setArg "set(${name} \"${value}") + else() + message(WARNING "Line '${line}' does not match regex. Ignoring.") + endif() + else() + # Assume this is a list to append to the last var + set(accumulator "${accumulator};${line}") + endif() + endforeach() + # Catch the final line of the args + if(setArg) + set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)") + set(script_initial_cache "${script_initial_cache}\n${setArg}") + endif() + # Replace location tags. + _ep_replace_location_tags(${target_name} script_initial_cache) + # Write out the initial cache file to the location specified. + if(NOT EXISTS "${script_filename}.in") + file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n") + endif() + configure_file("${script_filename}.in" "${script_filename}") +endfunction(_ep_write_initial_cache) + + function(ExternalProject_Get_Property name) foreach(var ${ARGN}) string(TOUPPER "${var}" VAR) @@ -711,7 +772,7 @@ endif() set(sep ";") endif() endforeach() - set(code "${code}set(command \"${cmd}\")${code_execute_process}") + set(code "set(ENV{VS_UNICODE_OUTPUT} \"\")\n${code}set(command \"${cmd}\")${code_execute_process}") file(WRITE ${stamp_dir}/${name}-${step}-impl.cmake "${code}") set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-impl.cmake) endif() @@ -721,6 +782,7 @@ endif() set(logbase ${stamp_dir}/${name}-${step}) file(WRITE ${script} " ${code_cygpath_make} +set(ENV{VS_UNICODE_OUTPUT} \"\") set(command \"${command}\") execute_process( COMMAND \${command} @@ -821,14 +883,7 @@ function(ExternalProject_Add_Step name step) endif() # Replace location tags. - foreach(var comment command work_dir) - if(${var}) - foreach(dir SOURCE_DIR BINARY_DIR INSTALL_DIR TMP_DIR) - get_property(val TARGET ${name} PROPERTY _EP_${dir}) - string(REPLACE "<${dir}>" "${val}" ${var} "${${var}}") - endforeach() - endif() - endforeach() + _ep_replace_location_tags(${name} comment command work_dir) # Custom comment? get_property(comment_set TARGET ${name} PROPERTY _EP_${step}_COMMENT SET) @@ -1224,11 +1279,24 @@ function(_ep_add_configure_command name) get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS) list(APPEND cmd ${cmake_args}) + # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it + get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS) + if(cmake_cache_args) + set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake") + _ep_write_initial_cache(${name} "${_ep_cache_args_script}" "${cmake_cache_args}") + list(APPEND cmd "-C${_ep_cache_args_script}") + endif() + get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR) if(cmake_generator) list(APPEND cmd "-G${cmake_generator}" "${source_dir}") else() - list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}") + if(CMAKE_EXTRA_GENERATOR) + list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}" + "${source_dir}") + else() + list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}") + endif() endif() endif() @@ -1237,10 +1305,11 @@ function(_ep_add_configure_command name) # Fixes issue http://public.kitware.com/Bug/view.php?id=10258 # if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in) - file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n") + file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n") endif() configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt) list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt) + list(APPEND file_deps ${_ep_cache_args_script}) get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE) if(log) diff --git a/Modules/FindALSA.cmake b/Modules/FindALSA.cmake index 0ad7643a0..40bd6f3da 100644 --- a/Modules/FindALSA.cmake +++ b/Modules/FindALSA.cmake @@ -35,7 +35,7 @@ find_library(ALSA_LIBRARY NAMES asound # handle the QUIETLY and REQUIRED arguments and set ALSA_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALSA DEFAULT_MSG ALSA_LIBRARY ALSA_INCLUDE_DIR) if(ALSA_FOUND) diff --git a/Modules/FindASPELL.cmake b/Modules/FindASPELL.cmake index 3319caac7..63ffdf922 100644 --- a/Modules/FindASPELL.cmake +++ b/Modules/FindASPELL.cmake @@ -26,7 +26,7 @@ FIND_LIBRARY(ASPELL_LIBRARIES NAMES aspell aspell-15 libaspell-15 libaspell) # handle the QUIETLY and REQUIRED arguments and set ASPELL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ASPELL DEFAULT_MSG ASPELL_LIBRARIES ASPELL_INCLUDE_DIR) MARK_AS_ADVANCED(ASPELL_INCLUDE_DIR ASPELL_LIBRARIES) diff --git a/Modules/FindAVIFile.cmake b/Modules/FindAVIFile.cmake index afd380073..90885acd1 100644 --- a/Modules/FindAVIFile.cmake +++ b/Modules/FindAVIFile.cmake @@ -37,7 +37,7 @@ ENDIF (UNIX) # handle the QUIETLY and REQUIRED arguments and set AVIFILE_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(AVIFile DEFAULT_MSG AVIFILE_INCLUDE_DIR AVIFILE_AVIPLAY_LIBRARY) IF (AVIFILE_FOUND) diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake index 1120fc115..fc5daa646 100644 --- a/Modules/FindBISON.cmake +++ b/Modules/FindBISON.cmake @@ -51,12 +51,19 @@ FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") MARK_AS_ADVANCED(BISON_EXECUTABLE) IF(BISON_EXECUTABLE) + # the bison commands should be executed with the C locale, otherwise + # the message (which are parsed) may be translated + SET(_Bison_SAVED_LC_ALL "$ENV{LC_ALL}") + SET(ENV{LC_ALL} C) EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version OUTPUT_VARIABLE BISON_version_output ERROR_VARIABLE BISON_version_error RESULT_VARIABLE BISON_version_result OUTPUT_STRIP_TRAILING_WHITESPACE) + + SET(ENV{LC_ALL} ${_Bison_SAVED_LC_ALL}) + IF(NOT ${BISON_version_result} EQUAL 0) MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}") ELSE() @@ -115,7 +122,7 @@ IF(BISON_EXECUTABLE) IF("${ARGV5}" STREQUAL "VERBOSE") BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}") ENDIF() - + IF("${ARGV5}" STREQUAL "COMPILE_FLAGS") BISON_TARGET_option_extraopts("${ARGV6}") ENDIF() @@ -125,10 +132,10 @@ IF(BISON_EXECUTABLE) LIST(APPEND BISON_TARGET_cmdopt "-d") STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}") STRING(REPLACE "c" "h" _fileext ${_fileext}) - STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" + STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" BISON_${Name}_OUTPUT_HEADER "${ARGV2}") LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}") - + ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs} ${BISON_TARGET_extraoutputs} COMMAND ${BISON_EXECUTABLE} @@ -136,7 +143,7 @@ IF(BISON_EXECUTABLE) DEPENDS ${ARGV1} COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - + # define target variables SET(BISON_${Name}_DEFINED TRUE) SET(BISON_${Name}_INPUT ${ARGV1}) @@ -151,7 +158,7 @@ IF(BISON_EXECUTABLE) ENDIF(BISON_EXECUTABLE) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE VERSION_VAR BISON_VERSION) diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake index 94bbed5ac..d57513c79 100644 --- a/Modules/FindBLAS.cmake +++ b/Modules/FindBLAS.cmake @@ -40,16 +40,11 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(BLAS_FIND_REQUIRED) - message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.") - else(BLAS_FIND_REQUIRED) - message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") # - return() - endif(BLAS_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - +if (NOT _LANGUAGES_ MATCHES Fortran) +include(CheckFunctionExists) +else () include(CheckFortranFunctionExists) +endif() macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads) # This macro checks for the existence of the combination of fortran libraries @@ -107,7 +102,11 @@ if(_libraries_work) # Test this combination of libraries. set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads}) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + if (_LANGUAGES_ MATCHES Fortran) + check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) + else() + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + endif() set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -246,13 +245,24 @@ endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All") #BLAS in acml library? if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All") + # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both if(NOT BLAS_LIBRARIES) check_fortran_libraries( BLAS_LIBRARIES BLAS sgemm "" - "acml" + "acml;acml_mv" + "" + ) + endif(NOT BLAS_LIBRARIES) + if(NOT BLAS_LIBRARIES) + check_fortran_libraries( + BLAS_LIBRARIES + BLAS + sgemm + "" + "acml_mp;acml_mv" "" ) endif(NOT BLAS_LIBRARIES) @@ -300,6 +310,9 @@ endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All") #BLAS in intel mkl 10 library? (em64t 64bit) if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") + if (NOT WIN32) + set(LM "-lm") + endif () if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED) find_package(Threads) @@ -340,7 +353,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -352,6 +365,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") "" "mkl_intel;mkl_intel_thread;mkl_core;guide" "${CMAKE_THREAD_LIBS_INIT}" + "${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -365,7 +379,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS95_LIBRARIES) else(BLA_F95) @@ -376,7 +390,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif(BLA_F95) @@ -391,7 +405,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, 32bit) @@ -402,7 +416,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_ia32;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) #BLAS in intel mkl library? (static, em64t 64bit) @@ -413,7 +427,7 @@ if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All") sgemm "" "mkl_em64t;guide" - "${CMAKE_THREAD_LIBS_INIT}" + "${CMAKE_THREAD_LIBS_INIT};${LM}" ) endif(NOT BLAS_LIBRARIES) endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX) diff --git a/Modules/FindBZip2.cmake b/Modules/FindBZip2.cmake index 0ef87fafa..e671f93b9 100644 --- a/Modules/FindBZip2.cmake +++ b/Modules/FindBZip2.cmake @@ -26,7 +26,7 @@ FIND_LIBRARY(BZIP2_LIBRARIES NAMES bz2 bzip2 ) # handle the QUIETLY and REQUIRED arguments and set BZip2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR) IF (BZIP2_FOUND) diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index 3ae4e1410..f17e5998d 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -64,14 +64,15 @@ # Currently this module searches for the following version numbers: # 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.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 # # 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 # omit the 3rd version number from include paths if it is 0 although not all # binary Boost releases do so. # -# SET(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") +# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0") # # ===================================== ============= ======================== # @@ -163,6 +164,7 @@ # # These last three variables are available also as environment variables: +# Also, note they are completely UPPERCASE. # # BOOST_ROOT or BOOSTROOT The preferred installation prefix for searching for # Boost. Set this if the module has problems finding @@ -250,59 +252,59 @@ # And ELSE/ENDIF pairs were removed for readability. ######################################################################### -MACRO (_Boost_ADJUST_LIB_VARS basename) - IF (Boost_INCLUDE_DIR ) - IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) +macro(_Boost_ADJUST_LIB_VARS basename) + if(Boost_INCLUDE_DIR ) + if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) # if the generator supports configuration types then set # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ELSE() + if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) + set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + else() # if there are no configuration types and CMAKE_BUILD_TYPE has no value # then just use the release libraries - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - ENDIF() + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) + endif() # FIXME: This probably should be set for both cases - SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF() + set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) + endif() # if only the release version was found, set the debug variable also to the release version - IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) - ENDIF() + if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) + set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) + endif() # if only the debug version was found, set the release variable also to the debug version - IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) - SET(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) - ENDIF() + if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) + set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) + set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) + set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) + endif() - IF (Boost_${basename}_LIBRARY) + if(Boost_${basename}_LIBRARY) set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library") # Remove superfluous "debug" / "optimized" keywords from # Boost_LIBRARY_DIRS - FOREACH(_boost_my_lib ${Boost_${basename}_LIBRARY}) - GET_FILENAME_COMPONENT(_boost_my_lib_path "${_boost_my_lib}" PATH) - LIST(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) - ENDFOREACH() - LIST(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) + foreach(_boost_my_lib ${Boost_${basename}_LIBRARY}) + get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH) + list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path}) + endforeach() + list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory") - SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") - ENDIF(Boost_${basename}_LIBRARY) + set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found") + endif(Boost_${basename}_LIBRARY) - ENDIF (Boost_INCLUDE_DIR ) + endif(Boost_INCLUDE_DIR ) # Make variables changeble to the advanced user - MARK_AS_ADVANCED( + mark_as_advanced( Boost_${basename}_LIBRARY Boost_${basename}_LIBRARY_RELEASE Boost_${basename}_LIBRARY_DEBUG ) -ENDMACRO (_Boost_ADJUST_LIB_VARS) +endmacro(_Boost_ADJUST_LIB_VARS) #------------------------------------------------------------------------------- @@ -310,17 +312,17 @@ ENDMACRO (_Boost_ADJUST_LIB_VARS) # Runs compiler with "-dumpversion" and parses major/minor # version with a regex. # -FUNCTION(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) +function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) - EXEC_PROGRAM(${CMAKE_CXX_COMPILER} + exec_program(${CMAKE_CXX_COMPILER} ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion OUTPUT_VARIABLE _boost_COMPILER_VERSION ) - STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" + string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - SET(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) -ENDFUNCTION() + set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) +endfunction() # # A convenience function for marking desired components @@ -355,6 +357,13 @@ function(_Boost_SWAP_WITH_REALPATH _library _docstring) endif() endfunction() +function(_Boost_CHECK_SPELLING _var) + if(${_var}) + string(TOUPPER ${_var} _var_UC) + message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.") + endif() +endfunction() + # # End functions/macros # @@ -363,9 +372,9 @@ endfunction() -IF(NOT DEFINED Boost_USE_MULTITHREADED) - SET(Boost_USE_MULTITHREADED TRUE) -ENDIF() +if(NOT DEFINED Boost_USE_MULTITHREADED) + set(Boost_USE_MULTITHREADED TRUE) +endif() if(Boost_FIND_VERSION_EXACT) # The version may appear in a directory with or without the patch @@ -377,7 +386,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.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" + "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" "1.34" "1.33.1" "1.33.0" "1.33") @@ -406,49 +415,47 @@ endif(Boost_FIND_VERSION_EXACT) # Boost. set(Boost_ERROR_REASON) -SET( _boost_IN_CACHE TRUE) -IF(Boost_INCLUDE_DIR) +set( _boost_IN_CACHE TRUE) +if(Boost_INCLUDE_DIR) # On versions < 1.35, remove the System library from the considered list # since it wasn't added until 1.35. if(Boost_VERSION AND Boost_FIND_COMPONENTS) - math(EXPR _boost_maj "${Boost_VERSION} / 100000") - math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000") - if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35) + if(Boost_VERSION LESS 103500) list(REMOVE_ITEM Boost_FIND_COMPONENTS system) endif() endif() - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) - IF(NOT Boost_${COMPONENT}_FOUND) - SET( _boost_IN_CACHE FALSE) - ENDIF(NOT Boost_${COMPONENT}_FOUND) - ENDFOREACH(COMPONENT) -ELSE(Boost_INCLUDE_DIR) - SET( _boost_IN_CACHE FALSE) -ENDIF(Boost_INCLUDE_DIR) - -IF (_boost_IN_CACHE) + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) + if(NOT Boost_${COMPONENT}_FOUND) + set( _boost_IN_CACHE FALSE) + endif(NOT Boost_${COMPONENT}_FOUND) + endforeach(COMPONENT) +else(Boost_INCLUDE_DIR) + set( _boost_IN_CACHE FALSE) +endif(Boost_INCLUDE_DIR) + +if(_boost_IN_CACHE) # in cache already - SET(Boost_FOUND TRUE) - FOREACH(COMPONENT ${Boost_FIND_COMPONENTS}) - STRING(TOUPPER ${COMPONENT} COMPONENT) + set(Boost_FOUND TRUE) + foreach(COMPONENT ${Boost_FIND_COMPONENTS}) + string(TOUPPER ${COMPONENT} COMPONENT) _Boost_ADJUST_LIB_VARS( ${COMPONENT} ) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) - ENDFOREACH(COMPONENT) - SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) - IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY}) + endforeach(COMPONENT) + set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) + if(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + endif(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "boost ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION} " "is already in the cache. To view debugging messages, please clear the cache.") endif() -ELSE (_boost_IN_CACHE) +else(_boost_IN_CACHE) # Need to search for boost if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " @@ -468,7 +475,7 @@ ELSE (_boost_IN_CACHE) "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") endif() - IF(WIN32) + if(WIN32) # In windows, automatic linking is performed, so you do not have # to specify the libraries. If you are linking to a dynamic # runtime, then you can choose to link to either a static or a @@ -477,18 +484,18 @@ ELSE (_boost_IN_CACHE) # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be # linked dynamically. Alternatively you can force all Boost # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - + # This feature can be disabled for Boost library "whatever" by # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining # BOOST_ALL_NO_LIB. - + # If you want to observe which libraries are being linked against # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking # code to emit a #pragma message each time a library is selected # for linking. - SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS + set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define") - ENDIF(WIN32) + endif(WIN32) set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM C:/boost/include @@ -498,36 +505,33 @@ ELSE (_boost_IN_CACHE) /sw/local/include ) - # If Boost_ROOT was defined, gently correct the user - if(Boost_ROOT) - message("WARNING: Boost_ROOT was set which is incorrect and is being ignored. " - "You need to use BOOST_ROOT instead. " - "Also, we suggest setting Boost_NO_SYSTEM_PATHS.") - endif() + _Boost_CHECK_SPELLING(Boost_ROOT) + _Boost_CHECK_SPELLING(Boost_LIBRARYDIR) + _Boost_CHECK_SPELLING(Boost_INCLUDEDIR) # If BOOST_ROOT was defined in the environment, use it. if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") set(BOOST_ROOT $ENV{BOOST_ROOT}) - endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "") + endif() # If BOOSTROOT was defined in the environment, use it. if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") set(BOOST_ROOT $ENV{BOOSTROOT}) - endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "") + endif() # If BOOST_INCLUDEDIR was defined in the environment, use it. - IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) + if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR}) - ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" ) - + endif() + # If BOOST_LIBRARYDIR was defined in the environment, use it. - IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) + if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}) - ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" ) - - IF( BOOST_ROOT ) + endif() + + if( BOOST_ROOT ) file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT) - ENDIF( BOOST_ROOT ) + endif() if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " @@ -563,33 +567,33 @@ ELSE (_boost_IN_CACHE) endif( BOOST_INCLUDEDIR ) # ------------------------------------------------------------------------ - # Search for Boost include DIR + # Search for Boost include DIR # ------------------------------------------------------------------------ # Try to find Boost by stepping backwards through the Boost versions # we know about. - IF( NOT Boost_INCLUDE_DIR ) + if( NOT Boost_INCLUDE_DIR ) # Build a list of path suffixes for each version. - SET(_boost_PATH_SUFFIXES) - FOREACH(_boost_VER ${_boost_TEST_VERSIONS}) + set(_boost_PATH_SUFFIXES) + foreach(_boost_VER ${_boost_TEST_VERSIONS}) # Add in a path suffix, based on the required version, ideally # we could read this from version.hpp, but for that to work we'd # need to know the include dir already set(_boost_BOOSTIFIED_VERSION) # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" + if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" _boost_BOOSTIFIED_VERSION ${_boost_VER}) - ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+") - STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" + elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" _boost_BOOSTIFIED_VERSION ${_boost_VER}) - ENDIF() - + endif() + list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}") list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}") - ENDFOREACH(_boost_VER) - + endforeach(_boost_VER) + if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "Include debugging info:") @@ -600,62 +604,62 @@ ELSE (_boost_IN_CACHE) endif() # Look for a standard boost header file. - FIND_PATH(Boost_INCLUDE_DIR + find_path(Boost_INCLUDE_DIR NAMES boost/config.hpp HINTS ${_boost_INCLUDE_SEARCH_DIRS} PATH_SUFFIXES ${_boost_PATH_SUFFIXES} ${_boost_FIND_OPTIONS} ) - ENDIF( NOT Boost_INCLUDE_DIR ) - + endif( NOT Boost_INCLUDE_DIR ) + # ------------------------------------------------------------------------ # Extract version information from version.hpp # ------------------------------------------------------------------------ - IF(Boost_INCLUDE_DIR) + if(Boost_INCLUDE_DIR) # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp # Read the whole file: # - SET(BOOST_VERSION 0) - SET(BOOST_LIB_VERSION "") - FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) + set(BOOST_VERSION 0) + set(BOOST_LIB_VERSION "") + file(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS) if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") endif() - - STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") - STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") - - SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") - SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") - - IF(NOT "${Boost_VERSION}" STREQUAL "0") - MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") + + string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}") + string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}") + + set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries") + set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries") + + if(NOT "${Boost_VERSION}" STREQUAL "0") + math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") + math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") + math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") set(Boost_ERROR_REASON "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - ENDIF(NOT "${Boost_VERSION}" STREQUAL "0") + endif(NOT "${Boost_VERSION}" STREQUAL "0") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "version.hpp reveals boost " "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") endif() - ELSE(Boost_INCLUDE_DIR) + else(Boost_INCLUDE_DIR) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") - ENDIF(Boost_INCLUDE_DIR) - + endif(Boost_INCLUDE_DIR) + # ------------------------------------------------------------------------ # Suffix initialization and compiler suffix detection. # ------------------------------------------------------------------------ # Setting some more suffixes for the library - SET (Boost_LIB_PREFIX "") + set(Boost_LIB_PREFIX "") if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) - SET (Boost_LIB_PREFIX "lib") + set(Boost_LIB_PREFIX "lib") endif() if (Boost_COMPILER) @@ -670,7 +674,7 @@ ELSE (_boost_IN_CACHE) # please report them and use the Boost_COMPILER variable # to work around the problems. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" + OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") if(WIN32) set (_boost_COMPILER "-iw") @@ -678,54 +682,54 @@ ELSE (_boost_IN_CACHE) set (_boost_COMPILER "-il") endif() elseif (MSVC90) - SET (_boost_COMPILER "-vc90") + set(_boost_COMPILER "-vc90") elseif (MSVC10) - SET (_boost_COMPILER "-vc100") + set(_boost_COMPILER "-vc100") elseif (MSVC80) - SET (_boost_COMPILER "-vc80") + set(_boost_COMPILER "-vc80") elseif (MSVC71) - SET (_boost_COMPILER "-vc71") + set(_boost_COMPILER "-vc71") elseif (MSVC70) # Good luck! - SET (_boost_COMPILER "-vc7") # yes, this is correct + set(_boost_COMPILER "-vc7") # yes, this is correct elseif (MSVC60) # Good luck! - SET (_boost_COMPILER "-vc6") # yes, this is correct + set(_boost_COMPILER "-vc6") # yes, this is correct elseif (BORLAND) - SET (_boost_COMPILER "-bcb") + set(_boost_COMPILER "-bcb") elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro") set(_boost_COMPILER "-sw") elseif (MINGW) if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - SET(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 + set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 else() _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) - SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") + set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") endif() elseif (UNIX) if (CMAKE_COMPILER_IS_GNUCXX) if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - SET(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 + set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 else() _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) # Determine which version of GCC we have. - IF(APPLE) - IF(Boost_MINOR_VERSION) - IF(${Boost_MINOR_VERSION} GREATER 35) + if(APPLE) + if(Boost_MINOR_VERSION) + if(${Boost_MINOR_VERSION} GREATER 35) # In Boost 1.36.0 and newer, the mangled compiler name used # on Mac OS X/Darwin is "xgcc". - SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") - ELSE(${Boost_MINOR_VERSION} GREATER 35) + set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") + else(${Boost_MINOR_VERSION} GREATER 35) # In Boost <= 1.35.0, there is no mangled compiler name for # the Mac OS X/Darwin version of GCC. - SET(_boost_COMPILER "") - ENDIF(${Boost_MINOR_VERSION} GREATER 35) - ELSE(Boost_MINOR_VERSION) + set(_boost_COMPILER "") + endif(${Boost_MINOR_VERSION} GREATER 35) + else(Boost_MINOR_VERSION) # We don't know the Boost version, so assume it's # pre-1.36.0. - SET(_boost_COMPILER "") - ENDIF(Boost_MINOR_VERSION) - ELSE() - SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") - ENDIF() + set(_boost_COMPILER "") + endif(Boost_MINOR_VERSION) + else() + set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") + endif() endif() endif (CMAKE_COMPILER_IS_GNUCXX) endif() @@ -916,6 +920,7 @@ ELSE (_boost_IN_CACHE) ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} + ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED} ${Boost_LIB_PREFIX}boost_${COMPONENT} ) if(_boost_STATIC_RUNTIME_WORKAROUND) @@ -957,13 +962,13 @@ ELSE (_boost_IN_CACHE) # End finding boost libraries # ------------------------------------------------------------------------ - SET(Boost_INCLUDE_DIRS + set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR} ) - SET(Boost_FOUND FALSE) - IF(Boost_INCLUDE_DIR) - SET( Boost_FOUND TRUE ) + set(Boost_FOUND FALSE) + if(Boost_INCLUDE_DIR) + set( Boost_FOUND TRUE ) # Check the version of Boost against the requested version. if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) @@ -998,7 +1003,7 @@ ELSE (_boost_IN_CACHE) if (NOT Boost_FIND_VERSION_PATCH) set(Boost_FIND_VERSION_PATCH 0) endif (NOT Boost_FIND_VERSION_PATCH) - + # We'll set Boost_FOUND true again if we have an exact version match. set(Boost_FOUND FALSE) _Boost_MARK_COMPONENTS_FOUND(OFF) @@ -1017,7 +1022,7 @@ ELSE (_boost_IN_CACHE) set(Boost_ERROR_REASON "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON + set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") endif (Boost_FIND_VERSION_PATCH) if (NOT Boost_FIND_VERSION_EXACT) @@ -1036,7 +1041,7 @@ ELSE (_boost_IN_CACHE) string(TOLOWER ${COMPONENT} COMPONENT) list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) set( Boost_FOUND FALSE) - endif(NOT Boost_${COMPONENT}_FOUND) + endif() endforeach(COMPONENT) if(Boost_DEBUG) @@ -1057,67 +1062,67 @@ ELSE (_boost_IN_CACHE) list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) endif (_Boost_MISSING_COMPONENTS) - IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) # Compatibility Code for backwards compatibility with CMake # 2.4's FindBoost module. # Look for the boost library path. # Note that the user may not have installed any libraries # so it is quite possible the Boost_LIBRARY_PATH may not exist. - SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - - IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - - IF("${_boost_LIB_DIR}" MATCHES "/include$") + set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) + + if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() + + if("${_boost_LIB_DIR}" MATCHES "/include$") # Strip off the trailing "/include" in the path. - GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - ENDIF("${_boost_LIB_DIR}" MATCHES "/include$") - - IF(EXISTS "${_boost_LIB_DIR}/lib") - SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/lib") - IF(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) - ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib") - SET(_boost_LIB_DIR "") - ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib") - ENDIF(EXISTS "${_boost_LIB_DIR}/lib") - - IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") - ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) + endif() + + if(EXISTS "${_boost_LIB_DIR}/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib) + else() + if(EXISTS "${_boost_LIB_DIR}/stage/lib") + set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib) + else() + set(_boost_LIB_DIR "") + endif() + endif() + + if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") + set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory") + endif() - ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) + endif( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - ELSE(Boost_INCLUDE_DIR) - SET( Boost_FOUND FALSE) - ENDIF(Boost_INCLUDE_DIR) + else(Boost_INCLUDE_DIR) + set( Boost_FOUND FALSE) + endif(Boost_INCLUDE_DIR) - IF (Boost_FOUND) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + if(Boost_FOUND) + if(NOT Boost_FIND_QUIETLY) + message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") if(Boost_FIND_COMPONENTS) message(STATUS "Found the following Boost libraries:") endif() - ENDIF(NOT Boost_FIND_QUIETLY) - FOREACH ( COMPONENT ${Boost_FIND_COMPONENTS} ) - STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - IF ( Boost_${UPPERCOMPONENT}_FOUND ) - IF (NOT Boost_FIND_QUIETLY) - MESSAGE (STATUS " ${COMPONENT}") - ENDIF(NOT Boost_FIND_QUIETLY) - SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) - ENDIF ( Boost_${UPPERCOMPONENT}_FOUND ) - ENDFOREACH(COMPONENT) + endif(NOT Boost_FIND_QUIETLY) + foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) + string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) + if( Boost_${UPPERCOMPONENT}_FOUND ) + if(NOT Boost_FIND_QUIETLY) + message (STATUS " ${COMPONENT}") + endif(NOT Boost_FIND_QUIETLY) + set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY}) + endif( Boost_${UPPERCOMPONENT}_FOUND ) + endforeach(COMPONENT) else() if(Boost_FIND_REQUIRED) message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") @@ -1137,9 +1142,8 @@ ELSE (_boost_IN_CACHE) endif() # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(Boost_INCLUDE_DIR + mark_as_advanced(Boost_INCLUDE_DIR Boost_INCLUDE_DIRS Boost_LIBRARY_DIRS ) -ENDIF(_boost_IN_CACHE) - +endif(_boost_IN_CACHE) diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake index 50c852749..a7c6de2a6 100644 --- a/Modules/FindBullet.cmake +++ b/Modules/FindBullet.cmake @@ -31,7 +31,7 @@ macro(_FIND_BULLET_LIBRARY _var) find_library(${_var} NAMES ${ARGN} - PATHS + HINTS ${BULLET_ROOT} ${BULLET_ROOT}/out/release8/libs ${BULLET_ROOT}/out/debug8/libs @@ -50,9 +50,10 @@ macro(_BULLET_APPEND_LIBRARIES _list _release) endmacro() find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h - PATHS + HINTS ${BULLET_ROOT}/include ${BULLET_ROOT}/src + PATH_SUFFIXES bullet ) # Find the libraries @@ -69,7 +70,7 @@ _FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_d) # handle the QUIETLY and REQUIRED arguments and set BULLET_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Bullet DEFAULT_MSG BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY BULLET_SOFTBODY_LIBRARY BULLET_INCLUDE_DIR) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 91215d572..1547b1908 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -684,7 +684,7 @@ set(CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CUDA REQUIRED_VARS CUDA_TOOLKIT_ROOT_DIR diff --git a/Modules/FindCURL.cmake b/Modules/FindCURL.cmake index 68aca2d8b..07835facf 100644 --- a/Modules/FindCURL.cmake +++ b/Modules/FindCURL.cmake @@ -34,7 +34,7 @@ MARK_AS_ADVANCED(CURL_LIBRARY) # handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR) IF(CURL_FOUND) diff --git a/Modules/FindCVS.cmake b/Modules/FindCVS.cmake index 844a4854a..27691114a 100644 --- a/Modules/FindCVS.cmake +++ b/Modules/FindCVS.cmake @@ -65,5 +65,5 @@ mark_as_advanced(CVS_EXECUTABLE) # Handle the QUIETLY and REQUIRED arguments and set CVS_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(CVS DEFAULT_MSG CVS_EXECUTABLE) diff --git a/Modules/FindCoin3D.cmake b/Modules/FindCoin3D.cmake index d8b103a20..47d0c5575 100644 --- a/Modules/FindCoin3D.cmake +++ b/Modules/FindCoin3D.cmake @@ -76,7 +76,7 @@ ENDIF (WIN32) # handle the QUIETLY and REQUIRED arguments and set COIN3D_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Coin3D DEFAULT_MSG COIN3D_LIBRARIES COIN3D_INCLUDE_DIRS) MARK_AS_ADVANCED(COIN3D_INCLUDE_DIRS COIN3D_LIBRARIES ) diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake index 4fb6c3607..4485f438e 100644 --- a/Modules/FindCurses.cmake +++ b/Modules/FindCurses.cmake @@ -155,7 +155,7 @@ SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Curses DEFAULT_MSG CURSES_LIBRARY CURSES_INCLUDE_PATH) diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake index 4ff6eba19..69104c556 100644 --- a/Modules/FindCxxTest.cmake +++ b/Modules/FindCxxTest.cmake @@ -97,6 +97,11 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.4 (11/18/10) (CMake 2.8.4) +# Issue 11384: Added support to the CXX_ADD_TEST macro so header +# files (containing the tests themselves) show up in +# Visual Studio and other IDEs. +# # Version 1.3 (8/19/10) (CMake 2.8.3) # Included patch by Simone Rossetto to check if either Python or Perl # are present in the system. Whichever intepreter that is detected @@ -131,7 +136,7 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname) ) set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true) - add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname}) + add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname} ${ARGN}) if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) add_test(${_cxxtest_testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_cxxtest_testname}) @@ -160,7 +165,7 @@ find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl PATHS ${CXXTEST_INCLUDE_DIR}) if(PYTHONINTERP_FOUND OR PERL_FOUND) - include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") + include(FindPackageHandleStandardArgs) if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND)) set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE}) diff --git a/Modules/FindDCMTK.cmake b/Modules/FindDCMTK.cmake index 0bd84811b..3bed97f8d 100644 --- a/Modules/FindDCMTK.cmake +++ b/Modules/FindDCMTK.cmake @@ -132,7 +132,7 @@ if(DCMTK_ofstd_INCLUDE_DIR) mark_as_advanced(DCMTK_dcmtk_INCLUDE_DIR) endif() -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(DCMTK DEFAULT_MSG DCMTK_config_INCLUDE_DIR DCMTK_ofstd_INCLUDE_DIR diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index afe5cf16c..90f71bd83 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -30,7 +30,7 @@ FIND_PATH(DART_ROOT README.INSTALL # handle the QUIETLY and REQUIRED arguments and set DART_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Dart DEFAULT_MSG DART_ROOT) MARK_AS_ADVANCED(DART_ROOT) diff --git a/Modules/FindDevIL.cmake b/Modules/FindDevIL.cmake index 72d70d51b..c87e73624 100644 --- a/Modules/FindDevIL.cmake +++ b/Modules/FindDevIL.cmake @@ -25,7 +25,7 @@ # TODO: Add version support. # Tested under Linux and Windows (MSVC) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PATH(IL_INCLUDE_DIR il.h PATH_SUFFIXES include IL diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake index cc69d60d8..aa4973dac 100644 --- a/Modules/FindDoxygen.cmake +++ b/Modules/FindDoxygen.cmake @@ -76,7 +76,7 @@ FIND_PROGRAM(DOXYGEN_EXECUTABLE DOC "Doxygen documentation generation tool (http://www.doxygen.org)" ) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Doxygen DEFAULT_MSG DOXYGEN_EXECUTABLE) # diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index e97c31ecf..3c04b4cb7 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -26,7 +26,7 @@ FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat) # handle the QUIETLY and REQUIRED arguments and set EXPAT_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(EXPAT DEFAULT_MSG EXPAT_LIBRARY EXPAT_INCLUDE_DIR) # Copy the results to the output variables. diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index 272cdc7ab..481e1e251 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -36,8 +36,8 @@ # find_package(BISON) # find_package(FLEX) # -# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp -# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp) +# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp) +# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp) # ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser) # # include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -143,7 +143,7 @@ IF(FLEX_EXECUTABLE) ENDIF(FLEX_EXECUTABLE) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLEX REQUIRED_VARS FLEX_EXECUTABLE VERSION_VAR FLEX_VERSION) diff --git a/Modules/FindFLTK.cmake b/Modules/FindFLTK.cmake index eb5db81cf..03d4b8e14 100644 --- a/Modules/FindFLTK.cmake +++ b/Modules/FindFLTK.cmake @@ -292,7 +292,7 @@ ENDIF(NOT FLTK_DIR) ENDIF() LIST(APPEND FLTK_LIBRARIES ${FLTK_BASE_LIBRARY}) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) IF(FLTK_SKIP_FLUID) FIND_PACKAGE_HANDLE_STANDARD_ARGS(FLTK DEFAULT_MSG FLTK_LIBRARIES FLTK_INCLUDE_DIR) ELSE() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 0adfdc270..7762684a6 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -88,7 +88,7 @@ SET(FREETYPE_LIBRARIES "${FREETYPE_LIBRARY}") # handle the QUIETLY and REQUIRED arguments and set FREETYPE_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) diff --git a/Modules/FindGDAL.cmake b/Modules/FindGDAL.cmake index 4bc158016..2050c72c7 100644 --- a/Modules/FindGDAL.cmake +++ b/Modules/FindGDAL.cmake @@ -100,7 +100,7 @@ FIND_LIBRARY(GDAL_LIBRARY /usr/freeware ) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR) set(GDAL_LIBRARIES ${GDAL_LIBRARY}) diff --git a/Modules/FindGIF.cmake b/Modules/FindGIF.cmake index 784b4ec32..e0d25e19e 100644 --- a/Modules/FindGIF.cmake +++ b/Modules/FindGIF.cmake @@ -60,7 +60,7 @@ SET(GIF_LIBRARIES ${GIF_LIBRARY}) # handle the QUIETLY and REQUIRED arguments and set GIF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GIF DEFAULT_MSG GIF_LIBRARY GIF_INCLUDE_DIR) MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARY) diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake index d8b4f6313..caecca28b 100644 --- a/Modules/FindGTK2.cmake +++ b/Modules/FindGTK2.cmake @@ -66,6 +66,10 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +# Version 1.3 (11/9/2010) (CMake 2.8.4) +# * 11429: Add support for detecting GTK2 built with Visual Studio 10. +# Thanks to Vincent Levesque for the patch. + # Version 1.2 (8/30/2010) (CMake 2.8.3) # * Merge patch for detecting gdk-pixbuf library (split off # from core GTK in 2.21). Thanks to Vincent Untz for the patch @@ -237,15 +241,16 @@ function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version) set(_library ${_lib}) - if(_expand_vc) - # Add vc80/vc90 midfixes + if(_expand_vc AND MSVC) + # Add vc80/vc90/vc100 midfixes if(MSVC80) set(_library ${_library}-vc80) - set(_library_d ${_library}-d) elseif(MSVC90) set(_library ${_library}-vc90) - set(_library_d ${_library}-d) + elseif(MSVC10) + set(_library ${_library}-vc100) endif() + set(_library_d ${_library}-d) endif() if(GTK2_DEBUG) @@ -516,7 +521,7 @@ endif() set(_GTK2_did_we_find_everything true) # This gets set to GTK2_FOUND -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) foreach(_GTK2_component ${GTK2_FIND_COMPONENTS}) string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER) diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake index 720591a75..ef2852a70 100644 --- a/Modules/FindGTest.cmake +++ b/Modules/FindGTest.cmake @@ -146,7 +146,7 @@ else() _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind) endif() -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) if(GTEST_FOUND) diff --git a/Modules/FindGit.cmake b/Modules/FindGit.cmake index 818871516..af316d81c 100644 --- a/Modules/FindGit.cmake +++ b/Modules/FindGit.cmake @@ -35,6 +35,7 @@ endif() find_program(GIT_EXECUTABLE NAMES ${git_names} + PATH_SUFFIXES Git/cmd Git/bin DOC "git command line client" ) mark_as_advanced(GIT_EXECUTABLE) @@ -42,5 +43,5 @@ mark_as_advanced(GIT_EXECUTABLE) # Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE) diff --git a/Modules/FindGnuTLS.cmake b/Modules/FindGnuTLS.cmake index 4363bf7fa..5c41253ab 100644 --- a/Modules/FindGnuTLS.cmake +++ b/Modules/FindGnuTLS.cmake @@ -56,7 +56,7 @@ MARK_AS_ADVANCED(GNUTLS_INCLUDE_DIR GNUTLS_LIBRARY) # handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR) IF(GNUTLS_FOUND) diff --git a/Modules/FindGnuplot.cmake b/Modules/FindGnuplot.cmake index e7375d463..364d72579 100644 --- a/Modules/FindGnuplot.cmake +++ b/Modules/FindGnuplot.cmake @@ -34,7 +34,7 @@ SET(GNUPLOT ${GNUPLOT_EXECUTABLE}) # handle the QUIETLY and REQUIRED arguments and set GNUPLOT_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gnuplot DEFAULT_MSG GNUPLOT_EXECUTABLE) MARK_AS_ADVANCED( GNUPLOT_EXECUTABLE ) diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 90c9de48e..30203f2b5 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -57,7 +57,7 @@ # This module is maintained by Will Dicharry . include(SelectLibraryConfigurations) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) # List of the valid HDF5 components set( HDF5_VALID_COMPONENTS diff --git a/Modules/FindHSPELL.cmake b/Modules/FindHSPELL.cmake index 283802726..3a8943f5a 100644 --- a/Modules/FindHSPELL.cmake +++ b/Modules/FindHSPELL.cmake @@ -36,7 +36,7 @@ ENDIF() # handle the QUIETLY and REQUIRED arguments and set HSPELL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(HSPELL DEFAULT_MSG HSPELL_LIBRARIES HSPELL_INCLUDE_DIR) MARK_AS_ADVANCED(HSPELL_INCLUDE_DIR HSPELL_LIBRARIES) diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake index 244ce5486..5f43dd951 100644 --- a/Modules/FindITK.cmake +++ b/Modules/FindITK.cmake @@ -21,7 +21,7 @@ # instead. #============================================================================= -# Copyright 2001-2009 Kitware, Inc. +# Copyright 2001-2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -33,67 +33,23 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -SET(ITK_DIR_STRING "directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.") +# Use the Config mode of the find_package() command to find ITKConfig. +# If this succeeds (possibly because ITK_DIR is already set), the +# command will have already loaded ITKConfig.cmake and set ITK_FOUND. +IF(NOT ITK_FOUND) + FIND_PACKAGE(ITK QUIET NO_MODULE + NAMES ITK InsightToolkit + CONFIGS ITKConfig.cmake + ) +ENDIF() -# Search only if the location is not already known. -IF(NOT ITK_DIR) - # Get the system search path as a list. - IF(UNIX) - STRING(REGEX MATCHALL "[^:]+" ITK_DIR_SEARCH1 "$ENV{PATH}") - ELSE(UNIX) - STRING(REGEX REPLACE "\\\\" "/" ITK_DIR_SEARCH1 "$ENV{PATH}") - ENDIF(UNIX) - STRING(REGEX REPLACE "/;" ";" ITK_DIR_SEARCH2 ${ITK_DIR_SEARCH1}) - - # Construct a set of paths relative to the system search path. - SET(ITK_DIR_SEARCH "") - FOREACH(dir ${ITK_DIR_SEARCH2}) - SET(ITK_DIR_SEARCH ${ITK_DIR_SEARCH} "${dir}/../lib/InsightToolkit") - ENDFOREACH(dir) - - # - # Look for an installation or build tree. - # - FIND_PATH(ITK_DIR ITKConfig.cmake - # Look for an environment variable ITK_DIR. - $ENV{ITK_DIR} - - # Look in places relative to the system executable search path. - ${ITK_DIR_SEARCH} - - # Look in standard UNIX install locations. - /usr/local/lib/InsightToolkit - /usr/lib/InsightToolkit - - # Read from the CMakeSetup registry entries. It is likely that - # ITK will have been recently built. - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9] - [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10] - - # Help the user find it if we cannot. - DOC "The ${ITK_DIR_STRING}" - ) -ENDIF(NOT ITK_DIR) - -# If ITK was found, load the configuration file to get the rest of the -# settings. -IF(ITK_DIR) - SET(ITK_FOUND 1) - INCLUDE(${ITK_DIR}/ITKConfig.cmake) +SET(ITK_DIR_MESSAGE "Please set ITK_DIR to the directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.") +IF(ITK_FOUND) # Set USE_ITK_FILE for backward-compatability. SET(USE_ITK_FILE ${ITK_USE_FILE}) -ELSE(ITK_DIR) - SET(ITK_FOUND 0) - IF(ITK_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Please set ITK_DIR to the ${ITK_DIR_STRING}") - ENDIF(ITK_FIND_REQUIRED) -ENDIF(ITK_DIR) +ELSEIF(ITK_FIND_REQUIRED) + MESSAGE(FATAL_ERROR ${ITK_DIR_MESSAGE}) +ELSEIF(NOT ITK_FIND_QUIETLY) + MESSAGE(STATUS ${ITK_DIR_MESSAGE}) +ENDIF() diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake index 774b2addb..3afcb1c51 100644 --- a/Modules/FindImageMagick.cmake +++ b/Modules/FindImageMagick.cmake @@ -171,7 +171,7 @@ SET(ImageMagick_LIBRARIES ${ImageMagick_LIBRARIES}) #--------------------------------------------------------------------- # Standard Package Output #--------------------------------------------------------------------- -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS( ImageMagick DEFAULT_MSG ImageMagick_FOUND ) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index d9395b863..5d70f0b11 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -232,7 +232,7 @@ FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h ${JAVA_INCLUDE_PATH} ) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) 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/FindJPEG.cmake b/Modules/FindJPEG.cmake index 721f40030..1f374839b 100644 --- a/Modules/FindJPEG.cmake +++ b/Modules/FindJPEG.cmake @@ -27,7 +27,7 @@ FIND_LIBRARY(JPEG_LIBRARY NAMES ${JPEG_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(JPEG DEFAULT_MSG JPEG_LIBRARY JPEG_INCLUDE_DIR) IF(JPEG_FOUND) diff --git a/Modules/FindJasper.cmake b/Modules/FindJasper.cmake index fde516501..8aaa3731b 100644 --- a/Modules/FindJasper.cmake +++ b/Modules/FindJasper.cmake @@ -27,7 +27,7 @@ FIND_LIBRARY(JASPER_LIBRARY NAMES jasper libjasper) # handle the QUIETLY and REQUIRED arguments and set JASPER_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Jasper DEFAULT_MSG JASPER_LIBRARY JASPER_INCLUDE_DIR JPEG_LIBRARIES) IF (JASPER_FOUND) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index acdbb7050..159943315 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -150,7 +150,7 @@ FIND_PROGRAM(Java_JAVAC_EXECUTABLE PATHS ${_JAVA_PATHS} ) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) if(Java_FIND_COMPONENTS) foreach(component ${Java_FIND_COMPONENTS}) # User just want to execute some Java byte-compiled diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake index 40effb04d..bf4540677 100644 --- a/Modules/FindLAPACK.cmake +++ b/Modules/FindLAPACK.cmake @@ -37,17 +37,12 @@ # License text for the above reference.) get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES) -if(NOT _LANGUAGES_ MATCHES Fortran) - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "FindLAPACK is Fortran-only so Fortran must be enabled.") - else(LAPACK_FIND_REQUIRED) - message(STATUS "Looking for LAPACK... - NOT found (Fortran not enabled)") - return() - endif(LAPACK_FIND_REQUIRED) -endif(NOT _LANGUAGES_ MATCHES Fortran) - +if (NOT _LANGUAGES_ MATCHES Fortran) +include(CheckFunctionExists) +else (NOT _LANGUAGES_ MATCHES Fortran) include(CheckFortranFunctionExists) +endif (NOT _LANGUAGES_ MATCHES Fortran) + set(LAPACK_FOUND FALSE) set(LAPACK95_FOUND FALSE) @@ -112,7 +107,11 @@ if(_libraries_work) set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threads}) endif(UNIX AND BLA_STATIC) # message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") - check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + if (NOT _LANGUAGES_ MATCHES Fortran) + check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS) + else (NOT _LANGUAGES_ MATCHES Fortran) + check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS) + endif (NOT _LANGUAGES_ MATCHES Fortran) set(CMAKE_REQUIRED_LIBRARIES) mark_as_advanced(${_prefix}${_combined_name}_WORKS) set(_libraries_work ${${_prefix}${_combined_name}_WORKS}) @@ -157,7 +156,18 @@ if(BLAS_FOUND) LAPACK cheev "" - "acml" + "acml;acml_mv" + "" + "" + ) + endif(NOT LAPACK_LIBRARIES) + if(NOT LAPACK_LIBRARIES) + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "acml_mp;acml_mv" "" "" ) diff --git a/Modules/FindLibArchive.cmake b/Modules/FindLibArchive.cmake index 2104e700d..e7c2706b6 100644 --- a/Modules/FindLibArchive.cmake +++ b/Modules/FindLibArchive.cmake @@ -50,7 +50,7 @@ endif() # Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND # to TRUE if all listed variables are TRUE. -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LibArchive DEFAULT_MSG LibArchive_LIBRARY LibArchive_INCLUDE_DIR ) diff --git a/Modules/FindLibXml2.cmake b/Modules/FindLibXml2.cmake index 6152bfd97..250c20add 100644 --- a/Modules/FindLibXml2.cmake +++ b/Modules/FindLibXml2.cmake @@ -46,7 +46,7 @@ SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) diff --git a/Modules/FindLibXslt.cmake b/Modules/FindLibXslt.cmake index cb05b636e..0fcfbf599 100644 --- a/Modules/FindLibXslt.cmake +++ b/Modules/FindLibXslt.cmake @@ -40,7 +40,7 @@ FIND_LIBRARY(LIBXSLT_LIBRARIES NAMES xslt libxslt # handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXslt DEFAULT_MSG LIBXSLT_LIBRARIES LIBXSLT_INCLUDE_DIR) MARK_AS_ADVANCED(LIBXSLT_INCLUDE_DIR LIBXSLT_LIBRARIES) diff --git a/Modules/FindLua50.cmake b/Modules/FindLua50.cmake index cb979f1f0..091e596b2 100644 --- a/Modules/FindLua50.cmake +++ b/Modules/FindLua50.cmake @@ -87,7 +87,7 @@ ELSE(${LUA_LIBRARY_lua} MATCHES "framework") ENDIF(${LUA_LIBRARY_lua} MATCHES "framework") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua50 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) diff --git a/Modules/FindLua51.cmake b/Modules/FindLua51.cmake index ea3e8f661..e67d5455a 100644 --- a/Modules/FindLua51.cmake +++ b/Modules/FindLua51.cmake @@ -66,7 +66,7 @@ IF(LUA_LIBRARY) ENDIF(UNIX AND NOT APPLE) ENDIF(LUA_LIBRARY) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if # all listed variables are TRUE FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51 DEFAULT_MSG LUA_LIBRARIES LUA_INCLUDE_DIR) diff --git a/Modules/FindMPEG.cmake b/Modules/FindMPEG.cmake index 6de6ce36e..9d44ac4b1 100644 --- a/Modules/FindMPEG.cmake +++ b/Modules/FindMPEG.cmake @@ -34,7 +34,7 @@ FIND_LIBRARY( MPEG_vo_LIBRARY vo # handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG DEFAULT_MSG MPEG_INCLUDE_DIR MPEG_mpeg2_LIBRARY MPEG_vo_LIBRARY) IF(MPEG_FOUND) diff --git a/Modules/FindMPEG2.cmake b/Modules/FindMPEG2.cmake index 6961e879d..bc1cf2b0b 100644 --- a/Modules/FindMPEG2.cmake +++ b/Modules/FindMPEG2.cmake @@ -36,7 +36,7 @@ FIND_LIBRARY( MPEG2_vo_LIBRARY vo # handle the QUIETLY and REQUIRED arguments and set MPEG2_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPEG2 DEFAULT_MSG MPEG2_mpeg2_LIBRARY MPEG2_INCLUDE_DIR) IF(MPEG2_FOUND) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 78699cc65..4d1da5b6d 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -346,7 +346,7 @@ else (MPI_INCLUDE_PATH AND MPI_LIBRARY) set(MPI_FOUND FALSE) endif (MPI_INCLUDE_PATH AND MPI_LIBRARY) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH) diff --git a/Modules/FindMotif.cmake b/Modules/FindMotif.cmake index 8247afd97..f10154556 100644 --- a/Modules/FindMotif.cmake +++ b/Modules/FindMotif.cmake @@ -34,7 +34,7 @@ ENDIF(UNIX) # handle the QUIETLY and REQUIRED arguments and set MOTIF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Motif DEFAULT_MSG MOTIF_LIBRARIES MOTIF_INCLUDE_DIR) diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 982b4fd3d..8f794369d 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -97,7 +97,7 @@ FIND_LIBRARY(OPENAL_LIBRARY # handle the QUIETLY and REQUIRED arguments and set OPENAL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR) MARK_AS_ADVANCED(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 21aafa927..361896361 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -123,7 +123,6 @@ ELSE (WIN32) ENDIF(APPLE) ENDIF (WIN32) -SET( OPENGL_FOUND "NO" ) IF(OPENGL_gl_LIBRARY) IF(OPENGL_xmesa_INCLUDE_DIR) @@ -140,10 +139,7 @@ IF(OPENGL_gl_LIBRARY) SET( OPENGL_GLU_FOUND "NO" ) ENDIF(OPENGL_glu_LIBRARY) - SET( OPENGL_FOUND "YES" ) - # This deprecated setting is for backward compatibility with CMake1.4 - SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES}) ENDIF(OPENGL_gl_LIBRARY) @@ -151,6 +147,11 @@ ENDIF(OPENGL_gl_LIBRARY) # This deprecated setting is for backward compatibility with CMake1.4 SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) +# handle the QUIETLY and REQUIRED arguments and set OPENGL_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL DEFAULT_MSG OPENGL_gl_LIBRARY) + MARK_AS_ADVANCED( OPENGL_INCLUDE_DIR OPENGL_xmesa_INCLUDE_DIR diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index 30eb37af7..f149d9f2f 100644 --- a/Modules/FindOpenMP.cmake +++ b/Modules/FindOpenMP.cmake @@ -26,7 +26,7 @@ include(CheckCSourceCompiles) include(CheckCXXSourceCompiles) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) set(OpenMP_C_FLAG_CANDIDATES #Gnu diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index b599d99c8..d3d7fc259 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -113,7 +113,7 @@ ELSE(WIN32 AND NOT CYGWIN) ENDIF(WIN32 AND NOT CYGWIN) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OpenSSL DEFAULT_MSG OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIR diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index c4048bdd2..8e6abdb3d 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -231,7 +231,7 @@ else() endif() endif() - include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") + include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) endif() diff --git a/Modules/FindOpenThreads.cmake b/Modules/FindOpenThreads.cmake index 74aaa50e1..e1fe937a3 100644 --- a/Modules/FindOpenThreads.cmake +++ b/Modules/FindOpenThreads.cmake @@ -118,6 +118,6 @@ else() set(OPENTHREADS_LIBRARIES ${OPENTHREADS_LIBRARY}) endif() -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenThreads DEFAULT_MSG OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake index 8a20063ef..3b21f89e3 100644 --- a/Modules/FindPHP4.cmake +++ b/Modules/FindPHP4.cmake @@ -81,5 +81,5 @@ IF(APPLE) ENDFOREACH(symbol) ENDIF(APPLE) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP4 DEFAULT_MSG PHP4_EXECUTABLE PHP4_INCLUDE_PATH) diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake index c137172f0..4fb218b68 100644 --- a/Modules/FindPNG.cmake +++ b/Modules/FindPNG.cmake @@ -55,7 +55,7 @@ endif(ZLIB_FOUND) # handle the QUIETLY and REQUIRED arguments and set PNG_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PNG DEFAULT_MSG PNG_LIBRARY PNG_PNG_INCLUDE_DIR) mark_as_advanced(PNG_PNG_INCLUDE_DIR PNG_LIBRARY ) diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index 85172d0b2..87d1ff945 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -44,7 +44,7 @@ SET(PERL ${PERL_EXECUTABLE}) # handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl DEFAULT_MSG PERL_EXECUTABLE) MARK_AS_ADVANCED(PERL_EXECUTABLE) diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake index 4cb026392..91eb91d8e 100644 --- a/Modules/FindPerlLibs.cmake +++ b/Modules/FindPerlLibs.cmake @@ -147,6 +147,32 @@ if (PERL_EXECUTABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE}) endif (NOT PERL_VENDORLIB_RESULT_VARIABLE) + macro(perl_adjust_darwin_lib_variable varname) + string( TOUPPER PERL_${varname} FINDPERL_VARNAME ) + string( TOLOWER install${varname} PERL_VARNAME ) + + if (NOT PERL_MINUSV_OUTPUT_VARIABLE) + execute_process( + COMMAND + ${PERL_EXECUTABLE} -V + OUTPUT_VARIABLE + PERL_MINUSV_OUTPUT_VARIABLE + RESULT_VARIABLE + PERL_MINUSV_RESULT_VARIABLE + ) + endif() + + if (NOT PERL_MINUSV_RESULT_VARIABLE) + string(REGEX MATCH "(${PERL_VARNAME}.*points? to the Updates directory)" + PERL_NEEDS_ADJUSTMENT ${PERL_MINUSV_OUTPUT_VARIABLE}) + + if (PERL_NEEDS_ADJUSTMENT) + string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}}) + endif (PERL_NEEDS_ADJUSTMENT) + + endif (NOT PERL_MINUSV_RESULT_VARIABLE) + endmacro() + ### PERL_ARCHLIB execute_process( COMMAND @@ -158,6 +184,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_ARCHLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE}) + perl_adjust_darwin_lib_variable( ARCHLIB ) endif (NOT PERL_ARCHLIB_RESULT_VARIABLE) ### PERL_PRIVLIB @@ -171,6 +198,7 @@ if (PERL_EXECUTABLE) ) if (NOT PERL_PRIVLIB_RESULT_VARIABLE) string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE}) + perl_adjust_darwin_lib_variable( PRIVLIB ) endif (NOT PERL_PRIVLIB_RESULT_VARIABLE) @@ -230,7 +258,7 @@ endif (PERL_EXECUTABLE) # handle the QUIETLY and REQUIRED arguments and set PERLLIBS_FOUND to TRUE if # all listed variables are TRUE -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLUDE_PATH VERSION_VAR PERL_VERSION) diff --git a/Modules/FindPhysFS.cmake b/Modules/FindPhysFS.cmake index 5694c1ed9..c38f4bccc 100644 --- a/Modules/FindPhysFS.cmake +++ b/Modules/FindPhysFS.cmake @@ -56,6 +56,6 @@ FIND_LIBRARY(PHYSFS_LIBRARY # handle the QUIETLY and REQUIRED arguments and set PHYSFS_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PhysFS DEFAULT_MSG PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) diff --git a/Modules/FindProducer.cmake b/Modules/FindProducer.cmake index fcee1d984..d5aefb936 100644 --- a/Modules/FindProducer.cmake +++ b/Modules/FindProducer.cmake @@ -77,6 +77,6 @@ FIND_LIBRARY(PRODUCER_LIBRARY /opt ) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Producer DEFAULT_MSG PRODUCER_LIBRARY PRODUCER_INCLUDE_DIR) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index e79ae263b..c9823c270 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -111,7 +111,7 @@ if(WIN32) set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") endif() -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 645ca79c4..3592e4cd9 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -2,8 +2,9 @@ # This module finds if Python interpreter is installed and determines where the # executables are. This code sets the following variables: # -# PYTHONINTERP_FOUND - Was the Python executable found -# PYTHON_EXECUTABLE - path to the Python interpreter +# PYTHONINTERP_FOUND - Was the Python executable found +# PYTHON_EXECUTABLE - path to the Python interpreter +# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for # #============================================================================= @@ -19,25 +20,32 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -FIND_PROGRAM(PYTHON_EXECUTABLE - NAMES python2.7 python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5 python - PATHS - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.7\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.6\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.5\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.4\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.3\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.2\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.6\\InstallPath] - [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\1.5\\InstallPath] - ) +# Set up the versions we know about, in the order we will search. Always add +# the user supplied additional versions to the front. +set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + +# Run first with the Python version in the executable +foreach(_CURRENT_VERSION ${_Python_VERSIONS}) + set(_Python_NAMES python${_CURRENT_VERSION}) + if(WIN32) + list(APPEND _Python_NAMES python) + endif() + find_program(PYTHON_EXECUTABLE + NAMES ${_Python_NAMES} + PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] + ) +endforeach() +# Now without any version if we still haven't found it +if(NOT PYTHON_EXECUTABLE) + find_program(PYTHON_EXECUTABLE NAMES python) +endif() + # handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp DEFAULT_MSG PYTHON_EXECUTABLE) -MARK_AS_ADVANCED(PYTHON_EXECUTABLE) - +mark_as_advanced(PYTHON_EXECUTABLE) diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 10e92416f..780ffc2f8 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -3,12 +3,12 @@ # include files and libraries are. It also determines what the name of # the library is. This code sets the following variables: # -# PYTHONLIBS_FOUND - have the Python libs been found -# PYTHON_LIBRARIES - path to the python library -# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) -# PYTHON_INCLUDE_DIRS - path to where Python.h is found -# PYTHON_DEBUG_LIBRARIES - path to the debug library -# +# PYTHONLIBS_FOUND - have the Python libs been found +# PYTHON_LIBRARIES - path to the python library +# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated) +# PYTHON_INCLUDE_DIRS - path to where Python.h is found +# PYTHON_DEBUG_LIBRARIES - path to the debug library +# Python_ADDITIONAL_VERSIONS - list of additional Python versions to search for #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -27,7 +27,13 @@ INCLUDE(CMakeFindFrameworks) # Search for the python framework on Apple. CMAKE_FIND_FRAMEWORKS(Python) -FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) +# Set up the versions we know about, in the order we will search. Always add +# the user supplied additional versions to the front. +set(_Python_VERSIONS + ${Python_ADDITIONAL_VERSIONS} + 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) + +FOREACH(_CURRENT_VERSION ${_Python_VERSIONS}) STRING(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION}) IF(WIN32) FIND_LIBRARY(PYTHON_DEBUG_LIBRARY @@ -53,7 +59,7 @@ FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) PATH_SUFFIXES python${_CURRENT_VERSION}/config ) - # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if + # For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if # PYTHON_INCLUDE_DIR is not set. IF(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR) SET(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH @@ -78,9 +84,9 @@ FOREACH(_CURRENT_VERSION 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5) ) # For backward compatibility, set PYTHON_INCLUDE_PATH, but make it internal. - SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL + SET(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}" CACHE INTERNAL "Path to where Python.h is found (deprecated)") - + ENDFOREACH(_CURRENT_VERSION) MARK_AS_ADVANCED( @@ -98,12 +104,12 @@ SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs DEFAULT_MSG PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) # PYTHON_ADD_MODULE( src1 src2 ... srcN) is used to build modules for python. -# PYTHON_WRITE_MODULES_HEADER() writes a header file you can include +# PYTHON_WRITE_MODULES_HEADER() writes a header file you can include # in your sources to initialize the static python modules FUNCTION(PYTHON_ADD_MODULE _NAME ) GET_PROPERTY(_TARGET_SUPPORTS_SHARED_LIBS @@ -148,7 +154,7 @@ FUNCTION(PYTHON_WRITE_MODULES_HEADER _filename) SET(_filenameTmp "${_filename}.in") FILE(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n") - FILE(APPEND ${_filenameTmp} + FILE(APPEND ${_filenameTmp} "#ifndef ${_nameUpper} #define ${_nameUpper} @@ -164,7 +170,7 @@ extern \"C\" { FILE(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n") ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) - FILE(APPEND ${_filenameTmp} + FILE(APPEND ${_filenameTmp} "#ifdef __cplusplus } #endif /* __cplusplus */ @@ -182,7 +188,7 @@ extern \"C\" { ENDFOREACH(_currentModule ${PY_STATIC_MODULES_LIST}) FILE(APPEND ${_filenameTmp} "}\n\n") FILE(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n") - + # with CONFIGURE_FILE() cmake complains that you may not use a file created using FILE(WRITE) as input file for CONFIGURE_FILE() EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET) diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 3606a5f4f..1319de27d 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -242,9 +242,9 @@ IF (QT_MIN_VERSION) ENDIF (QT_MIN_VERSION) # if the include a library are found then we have it -IF(QT_INCLUDE_DIR AND QT_QT_LIBRARY) - SET( QT_FOUND "YES" ) -ENDIF(QT_INCLUDE_DIR AND QT_QT_LIBRARY) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3 DEFAULT_MSG QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE) +SET(QT_FOUND ${QT3_FOUND} ) IF(QT_FOUND) SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} ) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 45bbd2e58..d9d6ea7a9 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -482,7 +482,7 @@ IF (QT_QMAKE_EXECUTABLE) _qt4_query_qmake(QT_VERSION QTVERSION) # check for qt3 qmake and then try and find qmake4 or qmake-qt4 in the path - IF("${QTVERSION}" MATCHES "Unknown") + IF(NOT QTVERSION) SET(QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE) FIND_PROGRAM(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 PATHS "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\4.0.0;InstallDir]/bin" @@ -493,7 +493,7 @@ IF (QT_QMAKE_EXECUTABLE) IF(QT_QMAKE_EXECUTABLE) _qt4_query_qmake(QT_VERSION QTVERSION) ENDIF(QT_QMAKE_EXECUTABLE) - ENDIF("${QTVERSION}" MATCHES "Unknown") + ENDIF(NOT QTVERSION) # check that we found the Qt4 qmake, Qt3 qmake output won't match here STRING(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" qt_version_tmp "${QTVERSION}") @@ -1072,15 +1072,6 @@ IF (QT4_QMAKE_FOUND) # get the directory of the current file, used later on in the file GET_FILENAME_COMPONENT( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH) - ###################################### - # - # Macros for building Qt files - # - ###################################### - - INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") - - ###################################### # # decide if Qt got found @@ -1116,6 +1107,89 @@ IF (QT4_QMAKE_FOUND) INCLUDE("${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake") + ####################################### + # + # Check the plugins of Qt + # + ####################################### + + SET( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers ) + + SET( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets ) + SET( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer ) + SET( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs ) + SET( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows ) + SET( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin ) + SET( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb ) + SET( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem ) + SET( QT_ICONENGINES_PLUGINS qsvgicon ) + SET( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff ) + SET( QT_INPUTMETHODS_PLUGINS qimsw_multi ) + SET( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler ) + SET( QT_PHONON_BACKEND_PLUGINS phonon_qt7 ) + SET( QT_SCRIPT_PLUGINS qtscriptdbus ) + SET( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds ) + + IF(QT_QMAKE_CHANGED) + FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) + STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) + SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) + FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) + STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) + UNSET(QT_${_upper_qt_plugin}_LIBRARY_RELEASE CACHE) + UNSET(QT_${_upper_qt_plugin}_LIBRARY_DEBUG CACHE) + UNSET(QT_${_upper_qt_plugin}_LIBRARY CACHE) + UNSET(QT_${_upper_qt_plugin}_PLUGIN_RELEASE CACHE) + UNSET(QT_${_upper_qt_plugin}_PLUGIN_DEBUG CACHE) + UNSET(QT_${_upper_qt_plugin}_PLUGIN CACHE) + ENDFOREACH(QT_PLUGIN) + ENDFOREACH(QT_PLUGIN_TYPE) + ENDIF(QT_QMAKE_CHANGED) + + # find_library works better than find_file but we need to set prefixes to only match plugins + FOREACH(QT_PLUGIN_TYPE ${QT_PLUGIN_TYPES}) + STRING(TOUPPER ${QT_PLUGIN_TYPE} _upper_qt_plugin_type) + SET(QT_${_upper_qt_plugin_type}_PLUGINS_DIR ${QT_PLUGINS_DIR}/${QT_PLUGIN_TYPE}) + FOREACH(QT_PLUGIN ${QT_${_upper_qt_plugin_type}_PLUGINS}) + STRING(TOUPPER ${QT_PLUGIN} _upper_qt_plugin) + IF(QT_IS_STATIC) + FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_RELEASE + NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + ) + FIND_LIBRARY(QT_${_upper_qt_plugin}_LIBRARY_DEBUG + NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + ) + _QT4_ADJUST_LIB_VARS(${QT_PLUGIN}) + ELSE(QT_IS_STATIC) + # find_library works easier/better than find_file but we need to set suffixes to only match plugins + SET(CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_MODULE_SUFFIX} ${CMAKE_SHARED_LIBRARY_SUFFIX}) + FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_RELEASE + NAMES ${QT_PLUGIN}${QT_LIBINFIX} ${QT_PLUGIN}${QT_LIBINFIX}4 + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + ) + FIND_LIBRARY(QT_${_upper_qt_plugin}_PLUGIN_DEBUG + NAMES ${QT_PLUGIN}${QT_LIBINFIX}_debug ${QT_PLUGIN}${QT_LIBINFIX}d ${QT_PLUGIN}${QT_LIBINFIX}d4 + PATHS ${QT_${_upper_qt_plugin_type}_PLUGINS_DIR} NO_DEFAULT_PATH + ) + MARK_AS_ADVANCED(QT_${_upper_qt_plugin}_PLUGIN_RELEASE QT_${_upper_qt_plugin}_PLUGIN_DEBUG) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT}) + ENDIF(QT_IS_STATIC) + ENDFOREACH(QT_PLUGIN) + ENDFOREACH(QT_PLUGIN_TYPE) + + + ###################################### + # + # Macros for building Qt files + # + ###################################### + + INCLUDE("${_qt4_current_dir}/Qt4Macros.cmake") + + ####################################### # # compatibility settings diff --git a/Modules/FindQuickTime.cmake b/Modules/FindQuickTime.cmake index 3638e77ac..b86a59f5c 100644 --- a/Modules/FindQuickTime.cmake +++ b/Modules/FindQuickTime.cmake @@ -43,5 +43,5 @@ ENDIF(APPLE) # handle the QUIETLY and REQUIRED arguments and set QUICKTIME_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(QuickTime DEFAULT_MSG QUICKTIME_LIBRARY QUICKTIME_INCLUDE_DIR) diff --git a/Modules/FindRTI.cmake b/Modules/FindRTI.cmake index 9a01cde5e..b27eaa7a5 100644 --- a/Modules/FindRTI.cmake +++ b/Modules/FindRTI.cmake @@ -95,7 +95,7 @@ ENDIF (RTI_INCLUDE_DIR) # Set the modified system variables back to the original value. SET(CMAKE_FIND_LIBRARY_PREFIXES "${RTI_OLD_FIND_LIBRARY_PREFIXES}") -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(RTI DEFAULT_MSG RTI_LIBRARY RTI_INCLUDE_DIR) diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake index c54d5a168..2e78d85a6 100644 --- a/Modules/FindRuby.cmake +++ b/Modules/FindRuby.cmake @@ -209,7 +209,7 @@ ENDIF(WIN32) FIND_LIBRARY(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} ) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) SET(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY) IF(_RUBY_VERSION_SHORT_NODOT GREATER 18) LIST(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR) diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake index 028fef5ab..68a913de2 100644 --- a/Modules/FindSWIG.cmake +++ b/Modules/FindSWIG.cmake @@ -62,6 +62,6 @@ IF(SWIG_EXECUTABLE) ENDIF(SWIG_swiglib_result) ENDIF(SWIG_EXECUTABLE) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR VERSION_VAR SWIG_VERSION ) diff --git a/Modules/FindSubversion.cmake b/Modules/FindSubversion.cmake index 11f66b05e..3561a19d5 100644 --- a/Modules/FindSubversion.cmake +++ b/Modules/FindSubversion.cmake @@ -122,7 +122,7 @@ IF(Subversion_SVN_EXECUTABLE) ENDIF(Subversion_SVN_EXECUTABLE) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Subversion REQUIRED_VARS Subversion_SVN_EXECUTABLE VERSION_VAR Subversion_VERSION_SVN ) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index 8d780c14a..b206c9a5a 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -104,7 +104,7 @@ ENDIF(WIN32) FIND_LIBRARY(TCL_LIBRARY NAMES tcl - tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} + tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION} tcl86 tcl8.6 tcl85 tcl8.5 tcl84 tcl8.4 @@ -117,7 +117,7 @@ FIND_LIBRARY(TCL_LIBRARY FIND_LIBRARY(TK_LIBRARY NAMES tk - tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} + tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION} tk86 tk8.6 tk85 tk8.5 tk84 tk8.4 @@ -197,7 +197,7 @@ FIND_PATH(TK_INCLUDE_PATH # handle the QUIETLY and REQUIRED arguments and set TCL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH) SET(TCLTK_FIND_REQUIRED ${TCL_FIND_REQUIRED}) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index a5a4d243c..6f06ff199 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -27,7 +27,7 @@ FIND_LIBRARY(TIFF_LIBRARY NAMES ${TIFF_NAMES} ) # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(TIFF DEFAULT_MSG TIFF_LIBRARY TIFF_INCLUDE_DIR) IF(TIFF_FOUND) diff --git a/Modules/FindTclsh.cmake b/Modules/FindTclsh.cmake index 390a68e98..322c3a994 100644 --- a/Modules/FindTclsh.cmake +++ b/Modules/FindTclsh.cmake @@ -84,7 +84,7 @@ FIND_PROGRAM(TCL_TCLSH # handle the QUIETLY and REQUIRED arguments and set TIFF_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Tclsh DEFAULT_MSG TCL_TCLSH) MARK_AS_ADVANCED(TCL_TCLSH) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 488bbd5ad..4cb7451a4 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -153,5 +153,5 @@ IF(CMAKE_USE_PTHREADS_INIT) ENDIF() ENDIF(CMAKE_USE_PTHREADS_INIT) -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND) diff --git a/Modules/FindWget.cmake b/Modules/FindWget.cmake index ef4623f75..97c4302eb 100644 --- a/Modules/FindWget.cmake +++ b/Modules/FindWget.cmake @@ -26,7 +26,7 @@ FIND_PROGRAM(WGET_EXECUTABLE # handle the QUIETLY and REQUIRED arguments and set WGET_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Wget DEFAULT_MSG WGET_EXECUTABLE) MARK_AS_ADVANCED( WGET_EXECUTABLE ) diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 9d4fc0e69..1ac6c2c0e 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -66,7 +66,7 @@ ENDIF() # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB REQUIRED_VARS ZLIB_INCLUDE_DIR ZLIB_LIBRARY VERSION_VAR ZLIB_VERSION_STRING) diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake index 3c884d4a8..76f202f2a 100644 --- a/Modules/Findosg.cmake +++ b/Modules/Findosg.cmake @@ -50,5 +50,5 @@ include(Findosg_functions) OSG_FIND_PATH (OSG osg/PositionAttitudeTransform) OSG_FIND_LIBRARY(OSG osg) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osg DEFAULT_MSG OSG_LIBRARY OSG_INCLUDE_DIR) diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake index 6cfc78421..83e669ad6 100644 --- a/Modules/FindosgAnimation.cmake +++ b/Modules/FindosgAnimation.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGANIMATION osgAnimation/Animation) OSG_FIND_LIBRARY(OSGANIMATION osgAnimation) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgAnimation DEFAULT_MSG OSGANIMATION_LIBRARY OSGANIMATION_INCLUDE_DIR) diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake index 1da6cc014..f1cdfa51a 100644 --- a/Modules/FindosgDB.cmake +++ b/Modules/FindosgDB.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGDB osgDB/DatabasePager) OSG_FIND_LIBRARY(OSGDB osgDB) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgDB DEFAULT_MSG OSGDB_LIBRARY OSGDB_INCLUDE_DIR) diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake index dd8d6d83a..64cbda8d6 100644 --- a/Modules/FindosgFX.cmake +++ b/Modules/FindosgFX.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGFX osgFX/BumpMapping) OSG_FIND_LIBRARY(OSGFX osgFX) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgFX DEFAULT_MSG OSGFX_LIBRARY OSGFX_INCLUDE_DIR) diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake index ae96f817d..00fc313b3 100644 --- a/Modules/FindosgGA.cmake +++ b/Modules/FindosgGA.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGGA osgGA/FlightManipulator) OSG_FIND_LIBRARY(OSGGA osgGA) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgGA DEFAULT_MSG OSGGA_LIBRARY OSGGA_INCLUDE_DIR) diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake index b540cc073..919523b94 100644 --- a/Modules/FindosgIntrospection.cmake +++ b/Modules/FindosgIntrospection.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGINTROSPECTION osgIntrospection/Reflection) OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgIntrospection DEFAULT_MSG OSGINTROSPECTION_LIBRARY OSGINTROSPECTION_INCLUDE_DIR) diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake index b7cc02f72..93d4bac5e 100644 --- a/Modules/FindosgManipulator.cmake +++ b/Modules/FindosgManipulator.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGMANIPULATOR osgManipulator/TrackballDragger) OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgManipulator DEFAULT_MSG OSGMANIPULATOR_LIBRARY OSGMANIPULATOR_INCLUDE_DIR) diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake index e204597b2..a0d751623 100644 --- a/Modules/FindosgParticle.cmake +++ b/Modules/FindosgParticle.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGPARTICLE osgParticle/FireEffect) OSG_FIND_LIBRARY(OSGPARTICLE osgParticle) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgParticle DEFAULT_MSG OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake index ea6b33a35..e4e57f31c 100644 --- a/Modules/FindosgProducer.cmake +++ b/Modules/FindosgProducer.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGPRODUCER osgProducer/OsgSceneHandler) OSG_FIND_LIBRARY(OSGPRODUCER osgProducer) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgProducer DEFAULT_MSG OSGPRODUCER_LIBRARY OSGPRODUCER_INCLUDE_DIR) diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake index e569602cd..86a339c0d 100644 --- a/Modules/FindosgShadow.cmake +++ b/Modules/FindosgShadow.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGSHADOW osgShadow/ShadowTexture) OSG_FIND_LIBRARY(OSGSHADOW osgShadow) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgShadow DEFAULT_MSG OSGSHADOW_LIBRARY OSGSHADOW_INCLUDE_DIR) diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake index 865cb0b2c..b66a99154 100644 --- a/Modules/FindosgSim.cmake +++ b/Modules/FindosgSim.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGSIM osgSim/ImpostorSprite) OSG_FIND_LIBRARY(OSGSIM osgSim) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgSim DEFAULT_MSG OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake index 4dc961d7f..04559cf96 100644 --- a/Modules/FindosgTerrain.cmake +++ b/Modules/FindosgTerrain.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGTERRAIN osgTerrain/Terrain) OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgTerrain DEFAULT_MSG OSGTERRAIN_LIBRARY OSGTERRAIN_INCLUDE_DIR) diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake index ba78755b6..6d2033636 100644 --- a/Modules/FindosgText.cmake +++ b/Modules/FindosgText.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGTEXT osgText/Text) OSG_FIND_LIBRARY(OSGTEXT osgText) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgText DEFAULT_MSG OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake index 4f93e4318..2faa7d482 100644 --- a/Modules/FindosgUtil.cmake +++ b/Modules/FindosgUtil.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGUTIL osgUtil/SceneView) OSG_FIND_LIBRARY(OSGUTIL osgUtil) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgUtil DEFAULT_MSG OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake index f434fe4ec..30b9926e4 100644 --- a/Modules/FindosgViewer.cmake +++ b/Modules/FindosgViewer.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGVIEWER osgViewer/Viewer) OSG_FIND_LIBRARY(OSGVIEWER osgViewer) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgViewer DEFAULT_MSG OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR) diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake index 4a46d1e8d..f91666731 100644 --- a/Modules/FindosgVolume.cmake +++ b/Modules/FindosgVolume.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGVOLUME osgVolume/Volume) OSG_FIND_LIBRARY(OSGVOLUME osgVolume) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgVolume DEFAULT_MSG OSGVOLUME_LIBRARY OSGVOLUME_INCLUDE_DIR) diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake index e722c2d40..5f84873f7 100644 --- a/Modules/FindosgWidget.cmake +++ b/Modules/FindosgWidget.cmake @@ -46,6 +46,6 @@ include(Findosg_functions) OSG_FIND_PATH (OSGWIDGET osgWidget/Widget) OSG_FIND_LIBRARY(OSGWIDGET osgWidget) -include("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgWidget DEFAULT_MSG OSGWIDGET_LIBRARY OSGWIDGET_INCLUDE_DIR) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index b82ccd07d..d991cd492 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -827,7 +827,7 @@ DBG_MSG("wxWidgets_USE_FILE : ${wxWidgets_USE_FILE}") #===================================================================== #===================================================================== -INCLUDE("${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake") +INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(wxWidgets DEFAULT_MSG wxWidgets_FOUND) # Maintain consistency with all other variables. SET(wxWidgets_FOUND ${WXWIDGETS_FOUND}) diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt index 18014af5a..4bcaae916 100644 --- a/Modules/FortranCInterface/CMakeLists.txt +++ b/Modules/FortranCInterface/CMakeLists.txt @@ -45,10 +45,12 @@ set(module_symbols my_module_mp_my_sub_ # Intel MY_MODULE_mp_MY_SUB # Intel on Windows my_module_my_sub_ # PGI + my_module_MP_my_sub # NAG mymodule$mysub # HP mymodule_mp_mysub_ # Intel MYMODULE_mp_MYSUB # Intel on Windows mymodule_mysub_ # PGI + mymodule_MP_mysub # NAG ${FortranCInterface_MODULE_SYMBOLS} ) list(REMOVE_DUPLICATES module_symbols) diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake index b60fed8ea..4564e7445 100644 --- a/Modules/InstallRequiredSystemLibraries.cmake +++ b/Modules/InstallRequiredSystemLibraries.cmake @@ -1,16 +1,21 @@ -# By including this file, all files in the CMAKE_INSTALL_DEBUG_LIBRARIES, -# will be installed with INSTALL_PROGRAMS into /bin for WIN32 and /lib -# for non-win32. If CMAKE_SKIP_INSTALL_RULES is set to TRUE before including -# this file, then the INSTALL command is not called. The user can use -# the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a custom install -# command and install them into any directory they want. +# By including this file, all library files listed in the variable +# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS will be installed with +# INSTALL(PROGRAMS ...) into bin for WIN32 and lib +# for non-WIN32. If CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP is set to TRUE +# before including this file, then the INSTALL command is not called. +# The user can use the variable CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS to use a +# custom install command and install them however they want. # If it is the MSVC compiler, then the microsoft run # time libraries will be found and automatically added to the -# CMAKE_INSTALL_DEBUG_LIBRARIES, and installed. +# CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS, and installed. # If CMAKE_INSTALL_DEBUG_LIBRARIES is set and it is the MSVC # compiler, then the debug libraries are installed when available. +# If CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY is set then only the debug +# libraries are installed when both debug and release are available. # If CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time # libraries are installed as well as the CRT run time libraries. +# If CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are +# installed to that directory rather than the default. #============================================================================= # Copyright 2006-2009 Kitware, Inc. @@ -63,12 +68,14 @@ IF(MSVC) # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs - "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest" - "${MSVC80_CRT_DIR}/msvcm80.dll" - "${MSVC80_CRT_DIR}/msvcp80.dll" - "${MSVC80_CRT_DIR}/msvcr80.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs + "${MSVC80_CRT_DIR}/Microsoft.VC80.CRT.manifest" + "${MSVC80_CRT_DIR}/msvcm80.dll" + "${MSVC80_CRT_DIR}/msvcp80.dll" + "${MSVC80_CRT_DIR}/msvcr80.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) IF(CMAKE_INSTALL_DEBUG_LIBRARIES) SET(MSVC80_CRT_DIR @@ -96,12 +103,15 @@ IF(MSVC) # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs - "${MSVC90_CRT_DIR}/Microsoft.VC90.CRT.manifest" - "${MSVC90_CRT_DIR}/msvcm90.dll" - "${MSVC90_CRT_DIR}/msvcp90.dll" - "${MSVC90_CRT_DIR}/msvcr90.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs + "${MSVC90_CRT_DIR}/Microsoft.VC90.CRT.manifest" + "${MSVC90_CRT_DIR}/msvcm90.dll" + "${MSVC90_CRT_DIR}/msvcp90.dll" + "${MSVC90_CRT_DIR}/msvcr90.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + IF(CMAKE_INSTALL_DEBUG_LIBRARIES) SET(MSVC90_CRT_DIR "${MSVC90_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT") @@ -111,8 +121,8 @@ IF(MSVC) "${MSVC90_CRT_DIR}/msvcp90d.dll" "${MSVC90_CRT_DIR}/msvcr90d.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - ENDIF(MSVC90) + ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + ENDIF(MSVC90) IF(MSVC10) # Find the runtime library redistribution directory. @@ -126,11 +136,14 @@ IF(MSVC) # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs - "${MSVC10_CRT_DIR}/Microsoft.VC100.CRT.manifest" - "${MSVC10_CRT_DIR}/msvcp100.dll" - "${MSVC10_CRT_DIR}/msvcr100.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs + "${MSVC10_CRT_DIR}/Microsoft.VC100.CRT.manifest" + "${MSVC10_CRT_DIR}/msvcp100.dll" + "${MSVC10_CRT_DIR}/msvcr100.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + IF(CMAKE_INSTALL_DEBUG_LIBRARIES) SET(MSVC10_CRT_DIR "${MSVC10_REDIST_DIR}/Debug_NonRedist/${CMAKE_MSVC_ARCH}/Microsoft.VC90.DebugCRT") @@ -139,7 +152,7 @@ IF(MSVC) "${MSVC10_CRT_DIR}/msvcp100d.dll" "${MSVC10_CRT_DIR}/msvcr100d.dll" ) - ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) + ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) ENDIF(MSVC10) IF(CMAKE_INSTALL_MFC_LIBRARIES) @@ -165,17 +178,20 @@ IF(MSVC) "${MSVC80_MFC_DIR}/mfcm80ud.dll" ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - + SET(MSVC80_MFC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs ${__install__libs} - "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest" - "${MSVC80_MFC_DIR}/mfc80.dll" - "${MSVC80_MFC_DIR}/mfc80u.dll" - "${MSVC80_MFC_DIR}/mfcm80.dll" - "${MSVC80_MFC_DIR}/mfcm80u.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs ${__install__libs} + "${MSVC80_MFC_DIR}/Microsoft.VC80.MFC.manifest" + "${MSVC80_MFC_DIR}/mfc80.dll" + "${MSVC80_MFC_DIR}/mfc80u.dll" + "${MSVC80_MFC_DIR}/mfcm80.dll" + "${MSVC80_MFC_DIR}/mfcm80u.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + # include the language dll's for vs8 as well as the actuall dll's SET(MSVC80_MFCLOC_DIR "${MSVC80_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC80.MFCLOC") # Install the manifest that allows DLLs to be loaded from the @@ -206,17 +222,20 @@ IF(MSVC) "${MSVC90_MFC_DIR}/mfcm90ud.dll" ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - + SET(MSVC90_MFC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs ${__install__libs} - "${MSVC90_MFC_DIR}/Microsoft.VC90.MFC.manifest" - "${MSVC90_MFC_DIR}/mfc90.dll" - "${MSVC90_MFC_DIR}/mfc90u.dll" - "${MSVC90_MFC_DIR}/mfcm90.dll" - "${MSVC90_MFC_DIR}/mfcm90u.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs ${__install__libs} + "${MSVC90_MFC_DIR}/Microsoft.VC90.MFC.manifest" + "${MSVC90_MFC_DIR}/mfc90.dll" + "${MSVC90_MFC_DIR}/mfc90u.dll" + "${MSVC90_MFC_DIR}/mfcm90.dll" + "${MSVC90_MFC_DIR}/mfcm90u.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + # include the language dll's for vs9 as well as the actuall dll's SET(MSVC90_MFCLOC_DIR "${MSVC90_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC90.MFCLOC") # Install the manifest that allows DLLs to be loaded from the @@ -247,17 +266,20 @@ IF(MSVC) "${MSVC10_MFC_DIR}/mfcm100ud.dll" ) ENDIF(CMAKE_INSTALL_DEBUG_LIBRARIES) - + SET(MSVC10_MFC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFC") # Install the manifest that allows DLLs to be loaded from the # directory containing the executable. - SET(__install__libs ${__install__libs} - "${MSVC10_MFC_DIR}/Microsoft.VC100.MFC.manifest" - "${MSVC10_MFC_DIR}/mfc100.dll" - "${MSVC10_MFC_DIR}/mfc100u.dll" - "${MSVC10_MFC_DIR}/mfcm100.dll" - "${MSVC10_MFC_DIR}/mfcm100u.dll" - ) + IF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + SET(__install__libs ${__install__libs} + "${MSVC10_MFC_DIR}/Microsoft.VC100.MFC.manifest" + "${MSVC10_MFC_DIR}/mfc100.dll" + "${MSVC10_MFC_DIR}/mfc100u.dll" + "${MSVC10_MFC_DIR}/mfcm100.dll" + "${MSVC10_MFC_DIR}/mfcm100u.dll" + ) + ENDIF(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY) + # include the language dll's for vs10 as well as the actuall dll's SET(MSVC10_MFCLOC_DIR "${MSVC10_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC100.MFCLOC") # Install the manifest that allows DLLs to be loaded from the @@ -292,10 +314,14 @@ ENDIF(MSVC) # specified by CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS. IF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) - IF(WIN32) - INSTALL_PROGRAMS(/bin ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) - ELSE(WIN32) - INSTALL_PROGRAMS(/lib ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}) - ENDIF(WIN32) + IF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION) + IF(WIN32) + SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION bin) + ELSE(WIN32) + SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION lib) + ENDIF(WIN32) + ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION) + INSTALL(PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} + DESTINATION ${CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION}) ENDIF(NOT CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP) ENDIF(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 776bc0718..df9d2d39d 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -25,7 +25,7 @@ !include "MUI.nsh" ;Default installation folder - InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" ;-------------------------------- ;General @@ -540,6 +540,7 @@ FunctionEnd @CPACK_NSIS_INSTALLER_MUI_ICON_CODE@ @CPACK_NSIS_INSTALLER_ICON_CODE@ @CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@ +@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@ ;-------------------------------- ;Pages @@ -906,7 +907,7 @@ Function .onInit ; install directory that is expected to be the ; default StrCpy $IS_DEFAULT_INSTALLDIR 0 - StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 + StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 StrCpy $IS_DEFAULT_INSTALLDIR 1 StrCpy $SV_ALLUSERS "JustMe" @@ -939,7 +940,7 @@ Function .onInit done: StrCmp $SV_ALLUSERS "AllUsers" 0 +3 StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 - StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index 6f72a75b7..5aad45bad 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -24,7 +24,8 @@ set(CMAKE_CREATE_WIN32_EXE "-mwindows") set(CMAKE_GNULD_IMAGE_VERSION "-Wl,--major-image-version,,--minor-image-version,") - +set(CMAKE_GENERATOR_RC windres) +enable_language(RC) macro(__cygwin_compiler_gnu lang) # Binary link rules. set(CMAKE_${lang}_CREATE_SHARED_MODULE diff --git a/Modules/Platform/CYGWIN-windres.cmake b/Modules/Platform/CYGWIN-windres.cmake new file mode 100644 index 000000000..8bc1b15e9 --- /dev/null +++ b/Modules/Platform/CYGWIN-windres.cmake @@ -0,0 +1 @@ +SET(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index b157f7215..b7ad2cee1 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,9 +1,53 @@ -SET(WIN32 1) +if("${CMAKE_MINIMUM_REQUIRED_VERSION}" VERSION_LESS "2.8.3.20101214") + set(__USE_CMAKE_LEGACY_CYGWIN_WIN32 1) +endif() +if(NOT DEFINED WIN32) + set(WIN32 0) + if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + if(NOT DEFINED CMAKE_LEGACY_CYGWIN_WIN32 + AND DEFINED ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + set(CMAKE_LEGACY_CYGWIN_WIN32 $ENV{CMAKE_LEGACY_CYGWIN_WIN32}) + endif() + if(CMAKE_LEGACY_CYGWIN_WIN32) + message(STATUS "Defining WIN32 under Cygwin due to CMAKE_LEGACY_CYGWIN_WIN32") + set(WIN32 1) + elseif("x${CMAKE_LEGACY_CYGWIN_WIN32}" STREQUAL "x") + message(WARNING "CMake no longer defines WIN32 on Cygwin!" + "\n" + "(1) If you are just trying to build this project, ignore this warning " + "or quiet it by setting CMAKE_LEGACY_CYGWIN_WIN32=0 in your environment or " + "in the CMake cache. " + "If later configuration or build errors occur then this project may " + "have been written under the assumption that Cygwin is WIN32. " + "In that case, set CMAKE_LEGACY_CYGWIN_WIN32=1 instead." + "\n" + "(2) If you are developing this project, add the line\n" + " set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required\n" + "at the top of your top-level CMakeLists.txt file or set the minimum " + "required version of CMake to 2.8.4 or higher. " + "Then teach your project to build on Cygwin without WIN32.") + endif() + elseif(DEFINED CMAKE_LEGACY_CYGWIN_WIN32) + message(AUTHOR_WARNING "CMAKE_LEGACY_CYGWIN_WIN32 ignored because\n" + " cmake_minimum_required(VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})\n" + "is at least 2.8.4.") + endif() +endif() +if(DEFINED __USE_CMAKE_LEGACY_CYGWIN_WIN32) + # Pass WIN32 legacy setting to scripts. + if(WIN32) + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 1) + else() + set(ENV{CMAKE_LEGACY_CYGWIN_WIN32} 0) + endif() + unset(__USE_CMAKE_LEGACY_CYGWIN_WIN32) +endif() + SET(CYGWIN 1) SET(CMAKE_SHARED_LIBRARY_PREFIX "cyg") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") -SET(CMAKE_SHARED_MODULE_PREFIX "lib") +SET(CMAKE_SHARED_MODULE_PREFIX "cyg") SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a") diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index f425eb9ac..8a50a6ab9 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -20,8 +20,8 @@ set(__DARWIN_COMPILER_GNU 1) macro(__darwin_compiler_gnu lang) # GNU does not have -shared on OS X - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -headerpad_max_install_names") - set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -headerpad_max_install_names") + set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") + set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names") endmacro() macro(cmake_gnu_has_isysroot lang) diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake new file mode 100644 index 000000000..933f9e1a2 --- /dev/null +++ b/Modules/Platform/Darwin-NAG-Fortran.cmake @@ -0,0 +1,5 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need -fpp explicitly on case-insensitive filesystem. +set(CMAKE_Fortran_COMPILE_OBJECT + " -fpp -o -c ") diff --git a/Modules/Platform/Darwin-icc.cmake b/Modules/Platform/Darwin-icc.cmake index 49aa84319..b62036cfb 100644 --- a/Modules/Platform/Darwin-icc.cmake +++ b/Modules/Platform/Darwin-icc.cmake @@ -33,11 +33,11 @@ SET(CMAKE_SHARED_MODULE_PREFIX "lib") SET(CMAKE_SHARED_MODULE_SUFFIX ".so") SET(CMAKE_MODULE_EXISTS 1) SET(CMAKE_DL_LIBS "") -SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names") -SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names") +SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index db0642e99..a99ff4a1c 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -33,8 +33,8 @@ SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") -SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names") -SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names") +SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names") +SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names") IF(HAVE_FLAG_SEARCH_PATHS_FIRST) SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") @@ -42,8 +42,8 @@ IF(HAVE_FLAG_SEARCH_PATHS_FIRST) ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST) SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1) -SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") -SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") +SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names") +SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names") SET(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") SET(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake new file mode 100644 index 000000000..353bae6dd --- /dev/null +++ b/Modules/Platform/Linux-NAG-Fortran.cmake @@ -0,0 +1,10 @@ +set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood. + +# Need one "-Wl," level to send flag through to gcc. +# Use "-Xlinker" to get through gcc to real linker. +set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") +set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,") +set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic") diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index ac635a50e..7084b83ba 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -56,6 +56,8 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") set(__WINDOWS_GNU_LD_RESPONSE 0) endif() +enable_language(RC) + macro(__windows_compiler_gnu lang) if(MSYS OR MINGW) diff --git a/Modules/Platform/Windows-Intel-C.cmake b/Modules/Platform/Windows-Intel-C.cmake new file mode 100644 index 000000000..767fec541 --- /dev/null +++ b/Modules/Platform/Windows-Intel-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-Intel) +__windows_compiler_intel(C) diff --git a/Modules/Platform/Windows-Intel-CXX.cmake b/Modules/Platform/Windows-Intel-CXX.cmake new file mode 100644 index 000000000..2845b0ffb --- /dev/null +++ b/Modules/Platform/Windows-Intel-CXX.cmake @@ -0,0 +1,4 @@ +include(Platform/Windows-Intel) +set(_COMPILE_CXX " /TP") +set(_FLAGS_CXX " /GX /GR") +__windows_compiler_intel(CXX) diff --git a/Modules/Platform/Windows-Intel-Fortran.cmake b/Modules/Platform/Windows-Intel-Fortran.cmake new file mode 100644 index 000000000..c959287cd --- /dev/null +++ b/Modules/Platform/Windows-Intel-Fortran.cmake @@ -0,0 +1,11 @@ +include(Platform/Windows-Intel) +set(CMAKE_BUILD_TYPE_INIT Debug) +set(_COMPILE_Fortran " /fpp") +set(CMAKE_Fortran_MODDIR_FLAG "-module:") +set(CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") +__windows_compiler_intel(Fortran) +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") +SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index e89392582..e7462ba9f 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -1,3 +1,66 @@ + +#============================================================================= +# Copyright 2002-2010 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.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_INTEL) + return() +endif() +set(__WINDOWS_INTEL 1) + +# make sure to enable languages after setting configuration types +ENABLE_LANGUAGE(RC) +SET(CMAKE_COMPILE_RESOURCE "rc /fo ") + +SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +SET(CMAKE_LINK_LIBRARY_FLAG "") +SET(WIN32 1) +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_CL_NOLOGO "/nologo") +ENDIF(CMAKE_VERBOSE_MAKEFILE) +SET(CMAKE_COMPILE_RESOURCE "rc /fo ") +SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) +SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) + +# default to Debug builds +#SET(CMAKE_BUILD_TYPE_INIT Debug) +SET(CMAKE_BUILD_TYPE_INIT Release) + +SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") +SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") + +# executable linker flags +SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") +IF(MSVC_C_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_C_ARCHITECTURE_ID}") +ELSEIF(MSVC_CXX_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_CXX_ARCHITECTURE_ID}") +ELSEIF(MSVC_Fortran_ARCHITECTURE_ID) + SET(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}") +ENDIF() +SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}") +SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") +SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") + +SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) +SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) + INCLUDE("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) IF(NOT _INTEL_XILINK_TEST_RUN) @@ -15,3 +78,31 @@ SET(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) ") ENDIF(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") ENDIF(NOT _INTEL_XILINK_TEST_RUN) + +macro(__windows_compiler_intel lang) + set(CMAKE_${lang}_COMPILE_OBJECT + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo -c ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_SHARED_MODULE "${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + set(CMAKE_${lang}_LINK_EXECUTABLE + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Od /GZ") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/DNDEBUG /MD /O1") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/DNDEBUG /MD /O2") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/DNDEBUG /MD /Zi /O2") + + if(_INTEL_COMPILER_SUPPORTS_MANIFEST) + SET(CMAKE_${lang}_LINK_EXECUTABLE + " -E vs_link_exe ${CMAKE_${lang}_LINK_EXECUTABLE}") + SET(CMAKE_${lang}_CREATE_SHARED_LIBRARY + " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}") + SET(CMAKE_${lang}_CREATE_SHARED_MODULE + " -E vs_link_dll ${CMAKE_${lang}_CREATE_SHARED_MODULE}") + endif() +endmacro() diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 7463c62c5..56582ff5d 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -212,6 +212,8 @@ SET (CMAKE_EXE_LINKER_FLAGS_INIT SET( MSVC_INCREMENTAL_YES_FLAG "") IF(NOT MSVC_INCREMENTAL_DEFAULT) SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES") +ELSE() + SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" ) ENDIF() IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) diff --git a/Modules/Platform/Windows-g++.cmake b/Modules/Platform/Windows-g++.cmake deleted file mode 100644 index 3aa393cfa..000000000 --- a/Modules/Platform/Windows-g++.cmake +++ /dev/null @@ -1 +0,0 @@ -INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-gcc.cmake) diff --git a/Modules/Platform/Windows-icl.cmake b/Modules/Platform/Windows-icl.cmake deleted file mode 100644 index 9088cc7d1..000000000 --- a/Modules/Platform/Windows-icl.cmake +++ /dev/null @@ -1,109 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -# create a shared C++ library -SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - "xilink ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared module just copy the shared library rule -SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) - - -# create a C++ static library -SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") - -# create a C static library -SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) - -# compile a C++ file into an object file -SET(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -DWIN32 /Fo -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -SET(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -DWIN32 /Fo -c ${CMAKE_END_TEMP_FILE}") - - -SET(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") - -SET(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -# default to Debug builds -#SET(CMAKE_BUILD_TYPE_INIT Debug) -SET(CMAKE_BUILD_TYPE_INIT Release) -SET (CMAKE_CXX_FLAGS_INIT "/W3 /Zm1000 /GX /GR") -SET (CMAKE_CXX_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") -SET (CMAKE_C_FLAGS_INIT "/W3 /Zm1000") -SET (CMAKE_C_FLAGS_DEBUG_INIT "/MDd /Zi /Od /GZ") -SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1") -SET (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2") -SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2") - - -SET(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib") -SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) -IF(NOT _MACHINE_ARCH_FLAG) - SET(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) -ENDIF(NOT _MACHINE_ARCH_FLAG) -SET (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES /machine:${_MACHINE_ARCH_FLAG}") -SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") -SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) - - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_C_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") - SET(CMAKE_C_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_C_CREATE_SHARED_LIBRARY}") - SET(CMAKE_C_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_C_CREATE_SHARED_MODULE}") - SET(CMAKE_CXX_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - SET(CMAKE_CXX_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - SET(CMAKE_CXX_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake deleted file mode 100644 index 6cffed997..000000000 --- a/Modules/Platform/Windows-ifort.cmake +++ /dev/null @@ -1,80 +0,0 @@ -SET(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -SET(CMAKE_LINK_LIBRARY_FLAG "") -SET(WIN32 1) -IF(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO) -ELSE(CMAKE_VERBOSE_MAKEFILE) - SET(CMAKE_CL_NOLOGO "/nologo") -ENDIF(CMAKE_VERBOSE_MAKEFILE) - -SET(CMAKE_Fortran_MODDIR_FLAG "-module:") - -SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1) - -SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /dll ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) - -# create a C++ static library -SET(CMAKE_Fortran_CREATE_STATIC_LIBRARY "lib ${CMAKE_CL_NOLOGO} /out: ") - -# compile a C++ file into an object file -SET(CMAKE_Fortran_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /fpp /Fo -c ${CMAKE_END_TEMP_FILE}") - -SET(CMAKE_COMPILE_RESOURCE "rc /fo ") - -SET(CMAKE_Fortran_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") - -INCLUDE(Platform/Windows-Intel) - -IF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - SET(CMAKE_Fortran_LINK_EXECUTABLE - " -E vs_link_exe ${CMAKE_Fortran_LINK_EXECUTABLE}") - SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY - " -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}") - SET(CMAKE_Fortran_CREATE_SHARED_MODULE - " -E vs_link_dll ${CMAKE_Fortran_CREATE_SHARED_MODULE}") -ENDIF(_INTEL_COMPILER_SUPPORTS_MANIFEST) - -SET(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -SET(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) - -IF(CMAKE_GENERATOR MATCHES "Visual Studio 6") - SET (CMAKE_NO_BUILD_TYPE 1) -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") -IF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") - SET (CMAKE_NO_BUILD_TYPE 1) - SET (CMAKE_CONFIGURATION_TYPES "Debug;Release;MinSizeRel;RelWithDebInfo" CACHE STRING - "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") -ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visual Studio 8") -# does the compiler support pdbtype and is it the newer compiler - -SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") -SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") - -SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") - -# executable linker flags -SET (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") -SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES") -IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug /pdbtype:sept") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug /pdbtype:sept") -ELSE (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug") - SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug") -ENDIF (CMAKE_COMPILER_SUPPORTS_PDBTYPE) - -SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) -SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) diff --git a/Modules/Platform/Windows-windres.cmake b/Modules/Platform/Windows-windres.cmake new file mode 100644 index 000000000..8bc1b15e9 --- /dev/null +++ b/Modules/Platform/Windows-windres.cmake @@ -0,0 +1 @@ +SET(CMAKE_RC_COMPILE_OBJECT " -O coff ") diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake index bfb50de0a..10af3bc95 100644 --- a/Modules/Qt4ConfigDependentSettings.cmake +++ b/Modules/Qt4ConfigDependentSettings.cmake @@ -35,10 +35,10 @@ SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY}) IF(Q_WS_WIN) - # On Windows, qconfig.pri has "static" for static library builds - IF(QT_CONFIG MATCHES "static") + # On Windows, qconfig.pri has "shared" for shared library builds + IF(NOT QT_CONFIG MATCHES "shared") SET(QT_IS_STATIC 1) - ENDIF(QT_CONFIG MATCHES "static") + ENDIF(NOT QT_CONFIG MATCHES "shared") ELSE(Q_WS_WIN) # On other platforms, check file extension to know if its static IF(QT_QTCORE_LIBRARY_RELEASE) @@ -75,6 +75,23 @@ IF(QT_QCONFIG MATCHES "system-png") SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY}) ENDIF(QT_QCONFIG MATCHES "system-png") +## system jpeg +IF(QT_QCONFIG MATCHES "system-jpeg") + find_package(JPEG) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${JPEG_LIBRARIES}) +ENDIF(QT_QCONFIG MATCHES "system-jpeg") + +## system tiff +IF(QT_QCONFIG MATCHES "system-tiff") + find_package(TIFF) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${TIFF_LIBRARIES}) +ENDIF(QT_QCONFIG MATCHES "system-tiff") + +## system mng +IF(QT_QCONFIG MATCHES "system-mng") + find_library(MNG_LIBRARY NAMES mng) + SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${MNG_LIBRARY}) +ENDIF(QT_QCONFIG MATCHES "system-mng") # for X11, get X11 library directory IF(Q_WS_X11) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 700d3a246..86a74044e 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -71,12 +71,12 @@ MACRO (QT4_GET_MOC_FLAGS _moc_flags) GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES) FOREACH(_current ${_inc_DIRS}) - IF("${_current}" MATCHES ".framework/?$") - STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}") + IF("${_current}" MATCHES "\\.framework/?$") + STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}") SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}") - ELSE("${_current}" MATCHES ".framework/?$") + ELSE("${_current}" MATCHES "\\.framework/?$") SET(${_moc_flags} ${${_moc_flags}} "-I${_current}") - ENDIF("${_current}" MATCHES ".framework/?$") + ENDIF("${_current}" MATCHES "\\.framework/?$") ENDFOREACH(_current ${_inc_DIRS}) GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS) @@ -196,11 +196,16 @@ MACRO (QT4_ADD_RESOURCES outfiles ) ENDIF(NOT IS_ABSOLUTE "${_RC_FILE}") SET(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") ENDFOREACH(_RC_FILE) + # Since this cmake macro is doing the dependency scanning for these files, + # let's make a configured file and add it as a dependency so cmake is run + # again when dependencies need to be recomputed. + QT4_MAKE_OUTPUT_FILE("${infile}" "" "qrc.depends" out_depends) + CONFIGURE_FILE("${infile}" "${out_depends}" COPY_ONLY) ADD_CUSTOM_COMMAND(OUTPUT ${outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name ${outfilename} -o ${outfile} ${infile} MAIN_DEPENDENCY ${infile} - DEPENDS ${_RC_DEPENDS}) + DEPENDS ${_RC_DEPENDS} "${out_depends}") SET(${outfiles} ${${outfiles}} ${outfile}) ENDFOREACH (it) @@ -249,7 +254,15 @@ MACRO(QT4_GENERATE_DBUS_INTERFACE _header) # _customName OPTIONS -some -options GET_FILENAME_COMPONENT(_basename ${_header} NAME_WE) IF (_customName) - SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + if (IS_ABSOLUTE ${_customName}) + get_filename_component(_containingDir ${_customName} PATH) + if (NOT EXISTS ${_containingDir}) + file(MAKE_DIRECTORY "${_containingDir}") + endif() + SET(_target ${_customName}) + else() + SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_customName}) + endif() ELSE (_customName) SET(_target ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.xml) ENDIF (_customName) diff --git a/Modules/SystemInformation.cmake b/Modules/SystemInformation.cmake index d973e90f4..d4f22331d 100644 --- a/Modules/SystemInformation.cmake +++ b/Modules/SystemInformation.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2010 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,6 +12,7 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +CMAKE_MINIMUM_REQUIRED(VERSION ${CMAKE_VERSION}) PROJECT(DumpInformation) # first get the standard information for th platform diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 71284b2dc..f183eb4c6 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -131,6 +131,8 @@ SET(SRCS cmComputeTargetDepends.cxx cmCustomCommand.cxx cmCustomCommand.h + cmCustomCommandGenerator.cxx + cmCustomCommandGenerator.h cmDefinitions.cxx cmDefinitions.h cmDepends.cxx @@ -156,6 +158,7 @@ SET(SRCS cmDocumentationFormatterText.cxx cmDocumentationFormatterUsage.cxx cmDocumentationSection.cxx + cmDocumentGeneratorExpressions.h cmDocumentVariables.cxx cmDynamicLoader.cxx cmDynamicLoader.h @@ -183,6 +186,8 @@ SET(SRCS cmGlobalUnixMakefileGenerator3.cxx cmGlobalUnixMakefileGenerator3.h cmGraphAdjacencyList.h + cmGraphVizWriter.cxx + cmGraphVizWriter.h cmInstallGenerator.h cmInstallGenerator.cxx cmInstallExportGenerator.cxx @@ -332,7 +337,7 @@ ENDIF (WIN32) # create a library used by the command line and the GUI ADD_LIBRARY(CMakeLib ${SRCS}) -TARGET_LINK_LIBRARIES(CMakeLib cmsys +TARGET_LINK_LIBRARIES(CMakeLib cmsys ${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES} ${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES} ${CMAKE_CURL_LIBRARIES} ) @@ -432,7 +437,7 @@ IF(CYGWIN) CPack/cmCPackCygwinSourceGenerator.cxx ) ENDIF(CYGWIN) - + IF(UNIX) SET(CPACK_SRCS ${CPACK_SRCS} CPack/cmCPackDebGenerator.cxx diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx index c86434e46..46be99b6f 100644 --- a/Source/CPack/cmCPackArchiveGenerator.cxx +++ b/Source/CPack/cmCPackArchiveGenerator.cxx @@ -105,12 +105,12 @@ if (!archive) \ } //---------------------------------------------------------------------- -int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup) +int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup) { packageFileNames.clear(); // The default behavior is to have one package by component group // unless CPACK_COMPONENTS_IGNORE_GROUP is specified. - if (!ignoreComponentGroup) + if (!ignoreGroup) { std::map::iterator compGIt; for (compGIt=this->ComponentGroups.begin(); @@ -170,7 +170,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup) } //---------------------------------------------------------------------- -int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne) +int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent) { // reset the package file names packageFileNames.clear(); @@ -185,7 +185,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne) DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); // The ALL GROUP in ONE package case - if (! allComponentInOne) { + if (! allComponent) { // iterate over the component groups std::map::iterator compGIt; for (compGIt=this->ComponentGroups.begin(); @@ -226,78 +226,27 @@ int cmCPackArchiveGenerator::PackageFiles() cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " << toplevel << std::endl); - // The default behavior is to create 1 package by component group - // unless the user asked to put all COMPONENTS in a single package - bool allGroupInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE"))); - bool allComponentInOne = (NULL != - (this->GetOption( - "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))); - bool ignoreComponentGroup = ( NULL != - (this->GetOption( - "CPACK_COMPONENTS_IGNORE_GROUPS"))); + PrepareGroupingKind(); - std::string groupingType; - - // Second way to specify grouping - if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) { - groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING"); - } - - if (groupingType.length()>0) - { - cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" - << this->Name << "]" - << " requested component grouping = "<< groupingType <ComponentGroups.empty())) + ) { - ignoreComponentGroup = true; + return PackageComponentsAllInOne(allComponentInOne); } - else + // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) + // There will be 1 package for each component group + // however one may require to ignore component group and + // in this case you'll get 1 package for each component. + else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " requested component grouping type <"<< groupingType - << "> UNKNOWN not in (ALL_GROUP_IN_ONE," - "ALL_COMPONENT_IN_ONE,IGNORE)" <ComponentGroups.empty() && (!this->Components.empty()) - && (!ignoreComponentGroup)) { - cmCPackLogger(cmCPackLog::LOG_WARNING, "[" - << this->Name << "]" - << " Some Components defined but NO component group:" - << " Ignoring component group." - << std::endl); - ignoreComponentGroup = true; } - // CASE 1 : COMPONENT ALL-IN-ONE package - // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested - // then the package file is unique and should be open here. - if (allComponentInOne || (allGroupInOne && (!this->ComponentGroups.empty()))) - { - return PackageComponentsAllInOne(allComponentInOne); - } - // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one) - // There will be 1 package for each component group - // however one may require to ignore component group and - // in this case you'll get 1 package for each component. - else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup)) - { - return PackageComponents(ignoreComponentGroup); - } // CASE 3 : NON COMPONENT package. DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive); @@ -333,5 +282,15 @@ int cmCPackArchiveGenerator::GenerateHeader(std::ostream*) } bool cmCPackArchiveGenerator::SupportsComponentInstallation() const { - return true; + // The Component installation support should only + // be activated if explicitly requested by the user + // (for backward compatibility reason) + if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) + { + return true; + } + else + { + return false; + } } diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h index 6e173bd9c..dc172579a 100644 --- a/Source/CPack/cmCPackArchiveGenerator.h +++ b/Source/CPack/cmCPackArchiveGenerator.h @@ -60,12 +60,12 @@ protected: * install is used. This will create one * archive for each component group. */ - int PackageComponents(bool ignoreComponentGroup); + int PackageComponents(bool ignoreGroup); /** * Special case of component install where all * components will be put in a single installer. */ - int PackageComponentsAllInOne(bool allComponentInOne); + int PackageComponentsAllInOne(bool allComponent); virtual const char* GetOutputExtension() = 0; cmArchiveWrite::Compress Compress; cmArchiveWrite::Type Archive; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index c39aea4f2..feda52c06 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -35,6 +35,9 @@ cmCPackGenerator::cmCPackGenerator() this->GeneratorVerbose = false; this->MakefileMap = 0; this->Logger = 0; + this->allGroupInOne = false; + this->allComponentInOne = false; + this->ignoreComponentGroup = false; } //---------------------------------------------------------------------- @@ -220,7 +223,7 @@ int cmCPackGenerator::InstallProject() // If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES // then glob it and copy it to CPACK_TEMPORARY_DIRECTORY - // This is used in Source packageing + // This is used in Source packaging if ( !this->InstallProjectViaInstalledDirectories( setDestDir, tempInstallDirectory) ) { @@ -548,7 +551,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( std::vector componentsVector; bool componentInstall = false; - if (this->SupportsComponentInstallation()) + /* + * We do a component install iff + * - the CPack generator support component + * - the user did not request Monolithic install + * (this works at CPack time too) + */ + if (this->SupportsComponentInstallation() & + !(this->IsSet("CPACK_MONOLITHIC_INSTALL"))) { // Determine the installation types for this project (if provided). std::string installTypesVar = "CPACK_" @@ -691,7 +701,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( // // If DESTDIR has been 'internally set ON' this means that // the underlying CPack specific generator did ask for that - // In this case we may overrode CPACK_INSTALL_PREFIX with + // In this case we may override CPACK_INSTALL_PREFIX with // CPACK_PACKAGING_INSTALL_PREFIX // I know this is tricky and awkward but it's the price for // CPACK_SET_DESTDIR backward compatibility. @@ -727,7 +737,20 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( { dir = tempInstallDirectory + "/" + dir; } - + /* + * We must re-set DESTDIR for each component + * We must not add the CPACK_INSTALL_PREFIX part because + * it will be added using the override of CMAKE_INSTALL_PREFIX + * The main reason for this awkward trick is that + * are using DESTDIR for 2 different reasons: + * - Because it was asked by the CPack Generator or the user + * using CPACK_SET_DESTDIR + * - Because it was already used for component install + * in order to put things in subdirs... + */ + cmSystemTools::PutEnv( + (std::string("DESTDIR=")+tempInstallDirectory).c_str() + ); cmCPackLogger(cmCPackLog::LOG_DEBUG, "- Creating directory: '" << dir << "'" << std::endl); @@ -1047,7 +1070,13 @@ bool cmCPackGenerator::IsSet(const char* name) const } //---------------------------------------------------------------------- -const char* cmCPackGenerator::GetOption(const char* op) +bool cmCPackGenerator::IsOn(const char* name) const +{ + return cmSystemTools::IsOn(GetOption(name)); +} + +//---------------------------------------------------------------------- +const char* cmCPackGenerator::GetOption(const char* op) const { const char* ret = this->MakefileMap->GetDefinition(op); if(!ret) @@ -1195,6 +1224,70 @@ int cmCPackGenerator::CleanTemporaryDirectory() return 1; } +//---------------------------------------------------------------------- +int cmCPackGenerator::PrepareGroupingKind() +{ + // The default behavior is to create 1 package by component group + // unless the user asked to put all COMPONENTS in a single package + allGroupInOne = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE"))); + allComponentInOne = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE"))); + ignoreComponentGroup = (NULL != + (this->GetOption( + "CPACK_COMPONENTS_IGNORE_GROUPS"))); + + std::string groupingType; + + // Second way to specify grouping + if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) { + groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING"); + } + + if (groupingType.length()>0) + { + cmCPackLogger(cmCPackLog::LOG_VERBOSE, "[" + << this->Name << "]" + << " requested component grouping = "<< groupingType <Name << "]" + << " requested component grouping type <"<< groupingType + << "> UNKNOWN not in (ALL_GROUP_IN_ONE," + "ALL_COMPONENT_IN_ONE,IGNORE)" <ComponentGroups.empty() && (!this->Components.empty()) + && (!ignoreComponentGroup)) { + cmCPackLogger(cmCPackLog::LOG_WARNING, "[" + << this->Name << "]" + << " Some Components defined but NO component group:" + << " Ignoring component group." + << std::endl); + ignoreComponentGroup = true; + } + + return 1; +} + //---------------------------------------------------------------------- bool cmCPackGenerator::SupportsComponentInstallation() const { diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 74b780d5d..f44a334ad 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -88,8 +88,9 @@ public: //! Set and get the options void SetOption(const char* op, const char* value); void SetOptionIfNotSet(const char* op, const char* value); - const char* GetOption(const char* op); + const char* GetOption(const char* op) const; bool IsSet(const char* name) const; + bool IsOn(const char* name) const; //! Set all the variables int SetCMakeRoot(); @@ -119,6 +120,17 @@ protected: virtual const char* GetOutputExtension() { return ".cpack"; } virtual const char* GetOutputPostfix() { return 0; } + /** + * Prepare requested grouping kind from CPACK_xxx vars + * CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE + * CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE + * CPACK_COMPONENTS_IGNORE_GROUPS + * or + * CPACK_COMPONENTS_GROUPING + * @return 1 on success 0 on failure. + */ + virtual int PrepareGroupingKind(); + /** * Package the list of files and/or components which * has been prepared by the beginning of DoPackage. @@ -200,6 +212,20 @@ protected: */ std::map Components; std::map ComponentGroups; + /** + * If true All component groups will be put in a single package. + */ + bool allGroupInOne; + /** + * If true All component will be put in a single package. + */ + bool allComponentInOne; + /** + * If true component grouping will be ignored. + * You will still get 1 package for each component unless + * allComponentInOne is true. + */ + bool ignoreComponentGroup; cmCPackLog* Logger; private: diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index d0eda81e2..e5fe5759b 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -129,14 +129,21 @@ int cmCPackNSISGenerator::PackageFiles() cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Configure file: " << nsisInFileName << " to " << nsisFileName << std::endl); if(this->IsSet("CPACK_NSIS_MUI_ICON") - && this->IsSet("CPACK_NSIS_MUI_UNIICON")) + || this->IsSet("CPACK_NSIS_MUI_UNIICON")) { - std::string installerIconCode="!define MUI_ICON \""; - installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON"); - installerIconCode += "\"\n"; - installerIconCode += "!define MUI_UNICON \""; - installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON"); - installerIconCode += "\"\n"; + std::string installerIconCode; + if(this->IsSet("CPACK_NSIS_MUI_ICON")) + { + installerIconCode += "!define MUI_ICON \""; + installerIconCode += this->GetOption("CPACK_NSIS_MUI_ICON"); + installerIconCode += "\"\n"; + } + if(this->IsSet("CPACK_NSIS_MUI_UNIICON")) + { + installerIconCode += "!define MUI_UNICON \""; + installerIconCode += this->GetOption("CPACK_NSIS_MUI_UNIICON"); + installerIconCode += "\"\n"; + } this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_ICON_CODE", installerIconCode.c_str()); } @@ -149,6 +156,17 @@ int cmCPackNSISGenerator::PackageFiles() installerIconCode.c_str()); } + if(this->IsSet("CPACK_NSIS_MUI_FINISHPAGE_RUN")) + { + std::string installerRunCode = "!define MUI_FINISHPAGE_RUN \"$INSTDIR\\"; + installerRunCode += this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"); + installerRunCode += "\\"; + installerRunCode += this->GetOption("CPACK_NSIS_MUI_FINISHPAGE_RUN"); + installerRunCode += "\"\n"; + this->SetOptionIfNotSet("CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE", + installerRunCode.c_str()); + } + // Setup all of the component sections if (this->Components.empty()) { @@ -337,6 +355,7 @@ int cmCPackNSISGenerator::InitializeInternal() << std::endl); std::vector path; std::string nsisPath; + bool gotRegValue = true; #ifdef _WIN32 if ( !cmsys::SystemTools::ReadRegistryValue( @@ -346,24 +365,37 @@ int cmCPackNSISGenerator::InitializeInternal() if ( !cmsys::SystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) ) { - cmCPackLogger - (cmCPackLog::LOG_ERROR, - "Cannot find NSIS registry value. This is usually caused by NSIS " - "not being installed. Please install NSIS from " - "http://nsis.sourceforge.net" - << std::endl); - return 0; + gotRegValue = false; } } - path.push_back(nsisPath); + + if (gotRegValue) + { + path.push_back(nsisPath); + } #endif + nsisPath = cmSystemTools::FindProgram("makensis", path, false); + if ( nsisPath.empty() ) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find NSIS compiler" + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Cannot find NSIS compiler makensis: likely it is not installed, " + "or not in your PATH" << std::endl); + + if (!gotRegValue) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Could not read NSIS registry value. This is usually caused by " + "NSIS not being installed. Please install NSIS from " + "http://nsis.sourceforge.net" + << std::endl); + } + return 0; } + std::string nsisCmd = "\"" + nsisPath + "\" " NSIS_OPT "VERSION"; cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Test NSIS version: " << nsisCmd.c_str() << std::endl); @@ -400,10 +432,13 @@ int cmCPackNSISGenerator::InitializeInternal() return 0; } this->SetOptionIfNotSet("CPACK_INSTALLER_PROGRAM", nsisPath.c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_EXECUTABLES_DIRECTORY", "bin"); const char* cpackPackageExecutables = this->GetOption("CPACK_PACKAGE_EXECUTABLES"); const char* cpackPackageDeskTopLinks = this->GetOption("CPACK_CREATE_DESKTOP_LINKS"); + const char* cpackNsisExecutablesDirectory + = this->GetOption("CPACK_NSIS_EXECUTABLES_DIRECTORY"); std::vector cpackPackageDesktopLinksVector; if(cpackPackageDeskTopLinks) { @@ -426,12 +461,14 @@ int cmCPackNSISGenerator::InitializeInternal() cmCPackLogger(cmCPackLog::LOG_DEBUG, "CPACK_CREATE_DESKTOP_LINKS: " << "not set" << std::endl); } + + cmOStringStream str; + cmOStringStream deleteStr; + if ( cpackPackageExecutables ) { cmCPackLogger(cmCPackLog::LOG_DEBUG, "The cpackPackageExecutables: " << cpackPackageExecutables << "." << std::endl); - cmOStringStream str; - cmOStringStream deleteStr; std::vector cpackPackageExecutablesVector; cmSystemTools::ExpandListArgument(cpackPackageExecutables, cpackPackageExecutablesVector); @@ -451,7 +488,8 @@ int cmCPackNSISGenerator::InitializeInternal() ++ it; std::string linkName = *it; str << " CreateShortCut \"$SMPROGRAMS\\$STARTMENU_FOLDER\\" - << linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\"" + << linkName << ".lnk\" \"$INSTDIR\\" + << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\"" << std::endl; deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName << ".lnk\"" << std::endl; @@ -465,18 +503,21 @@ int cmCPackNSISGenerator::InitializeInternal() { str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; str << " CreateShortCut \"$DESKTOP\\" - << linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\"" + << linkName << ".lnk\" \"$INSTDIR\\" + << cpackNsisExecutablesDirectory << "\\" << execName << ".exe\"" << std::endl; deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n"; deleteStr << " Delete \"$DESKTOP\\" << linkName << ".lnk\"" << std::endl; } } - this->CreateMenuLinks(str, deleteStr); - this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str()); - this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS", - deleteStr.str().c_str()); } + + this->CreateMenuLinks(str, deleteStr); + this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS", + deleteStr.str().c_str()); + this->SetOptionIfNotSet("CPACK_NSIS_COMPRESSOR", "lzma"); return this->Superclass::InitializeInternal(); @@ -505,22 +546,25 @@ void cmCPackNSISGenerator::CreateMenuLinks( cmOStringStream& str, "." << std::endl); return; } + + cmsys::RegularExpression urlRegex; + urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$"); + std::vector::iterator it; for ( it = cpackMenuLinksVector.begin(); it != cpackMenuLinksVector.end(); ++it ) { std::string sourceName = *it; - bool url = false; - if(sourceName.find("http:") == 0) - { - url = true; - } - /* convert / to \\ */ + const bool url = urlRegex.find(sourceName); + + // Convert / to \ in filenames, but not in urls: + // if(!url) { cmSystemTools::ReplaceString(sourceName, "/", "\\"); } + ++ it; std::string linkName = *it; if(!url) diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 0641418b4..a5db78f40 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -37,13 +37,84 @@ int cmCPackRPMGenerator::InitializeInternal() //---------------------------------------------------------------------- int cmCPackRPMGenerator::PackageFiles() { - this->ReadListFile("CPackRPM.cmake"); + int retval = 1; + /* Digest Component grouping specification */ + retval = PrepareGroupingKind(); + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: " + << toplevel << std::endl); + + /* Are we in the component packaging case */ + if (SupportsComponentInstallation() & (!this->ComponentGroups.empty())) + { + /* Reset package file name list it will be populated during the + * component packaging run*/ + packageFileNames.clear(); + std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY")); + /* One Package per component CASE */ + /* Iterate over components */ + std::map::iterator compIt; + for (compIt=this->Components.begin(); + compIt!=this->Components.end(); ++compIt ) + { + std::string localToplevel(initialTopLevel); + std::string packageFileName( + cmSystemTools::GetParentDirectory(toplevel.c_str()) + ); + std::string outputFileName( + std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME") + ) + +"-"+compIt->first + this->GetOutputExtension()); + + localToplevel += "/"+ compIt->first; + /* replace the TEMP DIRECTORY with the component one */ + this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str()); + packageFileName += "/"+ outputFileName; + /* replace proposed CPACK_OUTPUT_FILE_NAME */ + this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str()); + /* replace the TEMPORARY package file name */ + this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME", + packageFileName.c_str()); + + this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str()); + if (!this->ReadListFile("CPackRPM.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackRPM.cmake" << std::endl); + retval = 0; + } + + // add the generated package to package file names list + packageFileNames.push_back(packageFileName); + } + } + /* This is the non component case */ + else + { + if (!this->ReadListFile("CPackRPM.cmake")) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Error while execution CPackRPM.cmake" << std::endl); + retval = 0; + } + } + if (!this->IsSet("RPMBUILD_EXECUTABLE")) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find rpmbuild" << std::endl); - return 0; + retval = 0; } - return 1; + return retval; } +bool cmCPackRPMGenerator::SupportsComponentInstallation() const + { + if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) + { + return true; + } + else + { + return false; + } + } diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 570e45f60..57d5cca70 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -39,6 +39,7 @@ protected: virtual int InitializeInternal(); virtual int PackageFiles(); virtual const char* GetOutputExtension() { return ".rpm"; } + virtual bool SupportsComponentInstallation() const; }; diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 3c5993de6..9678ac45c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -43,6 +43,7 @@ static const char* cmCTestErrorMatches[] = { "^[Bb]us [Ee]rror", "^[Ss]egmentation [Vv]iolation", "^[Ss]egmentation [Ff]ault", + ":.*[Pp]ermission [Dd]enied", "([^ :]+):([0-9]+): ([^ \\t])", "([^:]+): error[ \\t]*[0-9]+[ \\t]*:", "^Error ([0-9]+):", @@ -61,9 +62,9 @@ static const char* cmCTestErrorMatches[] = { ": syntax error ", "^collect2: ld returned 1 exit status", "ld terminated with signal", - "Unsatisfied symbols:", + "Unsatisfied symbol", "^Unresolved:", - "Undefined symbols:", + "Undefined symbol", "^Undefined[ \\t]+first referenced", "^CMake Error.*:", ":[ \\t]cannot find", diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index a6f10ec60..aa9e55b23 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -503,28 +503,15 @@ private: this->ParsePerson(this->Line.c_str()+7, author); this->Rev.Author = author.Name; this->Rev.EMail = author.EMail; - - // Convert the time to a human-readable format that is also easy - // to machine-parse: "CCYY-MM-DD hh:mm:ss". - time_t seconds = static_cast(author.Time); - struct tm* t = gmtime(&seconds); - char dt[1024]; - sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", - t->tm_year+1900, t->tm_mon+1, t->tm_mday, - t->tm_hour, t->tm_min, t->tm_sec); - this->Rev.Date = dt; - - // Add the time-zone field "+zone" or "-zone". - char tz[32]; - if(author.TimeZone >= 0) - { - sprintf(tz, " +%04ld", author.TimeZone); - } - else - { - sprintf(tz, " -%04ld", -author.TimeZone); - } - this->Rev.Date += tz; + this->Rev.Date = this->FormatDateTime(author); + } + else if(strncmp(this->Line.c_str(), "committer ", 10) == 0) + { + Person committer; + this->ParsePerson(this->Line.c_str()+10, committer); + this->Rev.Committer = committer.Name; + this->Rev.CommitterEMail = committer.EMail; + this->Rev.CommitDate = this->FormatDateTime(committer); } } @@ -537,6 +524,32 @@ private: } this->Rev.Log += "\n"; } + + std::string FormatDateTime(Person const& person) + { + // Convert the time to a human-readable format that is also easy + // to machine-parse: "CCYY-MM-DD hh:mm:ss". + time_t seconds = static_cast(person.Time); + struct tm* t = gmtime(&seconds); + char dt[1024]; + sprintf(dt, "%04d-%02d-%02d %02d:%02d:%02d", + t->tm_year+1900, t->tm_mon+1, t->tm_mday, + t->tm_hour, t->tm_min, t->tm_sec); + std::string out = dt; + + // Add the time-zone field "+zone" or "-zone". + char tz[32]; + if(person.TimeZone >= 0) + { + sprintf(tz, " +%04ld", person.TimeZone); + } + else + { + sprintf(tz, " -%04ld", -person.TimeZone); + } + out += tz; + return out; + } }; char const cmCTestGIT::CommitParser::SectionSep[SectionCount] = diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 8e305b72e..9831d0200 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -220,6 +220,13 @@ void cmCTestLaunch::ComputeFileNames() //---------------------------------------------------------------------------- void cmCTestLaunch::RunChild() { + // Ignore noopt make rules + if(this->RealArgs.empty() || this->RealArgs[0] == ":") + { + this->ExitCode = 0; + return; + } + // Prepare to run the real command. cmsysProcess* cp = this->Process; cmsysProcess_SetCommand(cp, this->RealArgV); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 0d14c2d74..f3a445716 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -275,12 +275,6 @@ void cmCTestMultiProcessHandler::StartNextTests() } numToStart -= processors; } - else - { - cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl - << "Test did not start waiting on depends to finish: " - << *test << "\n"); - } if(numToStart == 0) { return; @@ -434,7 +428,10 @@ void cmCTestMultiProcessHandler::ReadCostData() if(index == -1) continue; this->Properties[index]->PreviousRuns = prev; - if(this->Properties[index] && this->Properties[index]->Cost == 0) + // When not running in parallel mode, don't use cost data + if(this->ParallelLevel > 1 && + this->Properties[index] && + this->Properties[index]->Cost == 0) { this->Properties[index]->Cost = cost; } @@ -475,20 +472,19 @@ void cmCTestMultiProcessHandler::CreateTestCostList() { SortedTests.push_back(i->first); - //If the test failed last time, it should be run first, so max the cost - if(std::find(this->LastTestsFailed.begin(), - this->LastTestsFailed.end(), - this->Properties[i->first]->Name) - != this->LastTestsFailed.end()) + //If the test failed last time, it should be run first, so max the cost. + //Only do this for parallel runs; in non-parallel runs, avoid clobbering + //the test's explicitly set cost. + if(this->ParallelLevel > 1 && + std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), + this->Properties[i->first]->Name) != this->LastTestsFailed.end()) { this->Properties[i->first]->Cost = FLT_MAX; } } - if(this->ParallelLevel > 1) - { - TestComparator comp(this); - std::sort(SortedTests.begin(), SortedTests.end(), comp); - } + + TestComparator comp(this); + std::sort(SortedTests.begin(), SortedTests.end(), comp); } //--------------------------------------------------------- @@ -659,32 +655,37 @@ bool cmCTestMultiProcessHandler::CheckCycles() it != this->Tests.end(); ++it) { //DFS from each element to itself + int root = it->first; + std::set visited; std::stack s; - std::vector visited; - - s.push(it->first); - + s.push(root); while(!s.empty()) { int test = s.top(); s.pop(); - - for(TestSet::iterator d = this->Tests[test].begin(); - d != this->Tests[test].end(); ++d) + if(visited.insert(test).second) { - if(std::find(visited.begin(), visited.end(), *d) != visited.end()) + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) { - //cycle exists - cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " - "the test dependency graph for the test \"" - << this->Properties[it->first]->Name << "\"." << std::endl - << "Please fix the cycle and run ctest again." << std::endl); - return false; + if(*d == root) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, + "Error: a cycle exists in the test dependency graph " + "for the test \"" << this->Properties[root]->Name << + "\".\nPlease fix the cycle and run ctest again.\n"); + return false; + } + else + { + s.push(*d); + } } - s.push(*d); } - visited.push_back(test); } } + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph end" << std::endl); return true; } diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 76ff23a0d..42a4cff05 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -455,7 +455,8 @@ bool cmCTestRunTest::StartTest(size_t total) { return false; } - return this->ForkProcess(timeout, &this->TestProperties->Environment); + return this->ForkProcess(timeout, this->TestProperties->ExplicitTimeout, + &this->TestProperties->Environment); } //---------------------------------------------------------------------- @@ -598,7 +599,7 @@ double cmCTestRunTest::ResolveTimeout() } //---------------------------------------------------------------------- -bool cmCTestRunTest::ForkProcess(double testTimeOut, +bool cmCTestRunTest::ForkProcess(double testTimeOut, bool explicitTimeout, std::vector* environment) { this->TestProcess = new cmProcess; @@ -619,12 +620,16 @@ bool cmCTestRunTest::ForkProcess(double testTimeOut, { timeout = testTimeOut; } - // always have at least 1 second if we got to here if (timeout <= 0) { timeout = 1; } + // handle timeout explicitly set to 0 + if (testTimeOut == 0 && explicitTimeout) + { + timeout = 0; + } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, this->Index << ": " << "Test timeout computed to be: " << timeout << "\n"); diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 66e6b7b49..89456d505 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -63,8 +63,8 @@ private: void ExeNotFound(std::string exe); // Figures out a final timeout which is min(STOP_TIME, NOW+TIMEOUT) double ResolveTimeout(); - bool ForkProcess(double testTimeOut, - std::vector* environment); + bool ForkProcess(double testTimeOut, bool explicitTimeout, + std::vector* environment); void WriteLogOutputTop(size_t completed, size_t total); //Run post processing of the process output for MemCheck void MemCheckPostProcess(); diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h index 411eb018e..468cd8548 100644 --- a/Source/CTest/cmCTestSleepCommand.h +++ b/Source/CTest/cmCTestSleepCommand.h @@ -63,11 +63,10 @@ public: virtual const char* GetFullDocumentation() { return - " ctest_sleep( seconds )\n" - " ctest_sleep( time1 duration time2 )\n" - "With one argument it will sleep for a given number of seconds. " - "With three arguments it will wait for time2 - time1 - duration " - "seconds."; + " ctest_sleep()\n" + "Sleep for given number of seconds.\n" + " ctest_sleep( )\n" + "Sleep for t=(time1 + duration - time2) seconds if t > 0."; } cmTypeMacro(cmCTestSleepCommand, cmCTestCommand); diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6dd348def..87c75ebf8 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -26,6 +26,7 @@ #include "cmCommand.h" #include "cmSystemTools.h" #include "cmXMLSafe.h" +#include "cm_utf8.h" #include #include @@ -438,6 +439,8 @@ void cmCTestTestHandler::Initialize() this->TestsToRun.clear(); + this->UseIncludeLabelRegExpFlag = false; + this->UseExcludeLabelRegExpFlag = false; this->UseIncludeRegExpFlag = false; this->UseExcludeRegExpFlag = false; this->UseExcludeRegExpFirst = false; @@ -1978,65 +1981,45 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in) } } -//---------------------------------------------------------------------- -bool cmCTestTestHandler::CleanTestOutput(std::string& output, - size_t remove_threshold) +//---------------------------------------------------------------------------- +bool cmCTestTestHandler::CleanTestOutput(std::string& output, size_t length) { - if ( remove_threshold == 0 ) + if(!length || length >= output.size() || + output.find("CTEST_FULL_OUTPUT") != output.npos) { return true; } - if ( output.find("CTEST_FULL_OUTPUT") != output.npos ) + + // Truncate at given length but do not break in the middle of a multi-byte + // UTF-8 encoding. + char const* const begin = output.c_str(); + char const* const end = begin + output.size(); + char const* const truncate = begin + length; + char const* current = begin; + while(current < truncate) { - return true; - } - cmOStringStream ostr; - std::string::size_type cc; - std::string::size_type skipsize = 0; - int inTag = 0; - int skipped = 0; - for ( cc = 0; cc < output.size(); cc ++ ) - { - int ch = output[cc]; - if ( ch < 0 || ch > 255 ) - { - break; - } - if ( ch == '<' ) - { - inTag = 1; - } - if ( !inTag ) + unsigned int ch; + if(const char* next = cm_utf8_decode_character(current, end, &ch)) { - int notskip = 0; - // Skip - if ( skipsize < remove_threshold ) + if(next > truncate) { - ostr << static_cast(ch); - notskip = 1; - } - skipsize ++; - if ( notskip && skipsize >= remove_threshold ) - { - skipped = 1; + break; } + current = next; } - else - { - ostr << static_cast(ch); - } - if ( ch == '>' ) + else // Bad byte will be handled by cmXMLSafe. { - inTag = 0; + ++current; } } - if ( skipped ) - { - ostr << "..." << std::endl << "The rest of the test output was removed " - "since it exceeds the threshold of " - << remove_threshold << " characters." << std::endl; - } - output = ostr.str(); + output = output.substr(0, current - begin); + + // Append truncation message. + cmOStringStream msg; + msg << "...\n" + "The rest of the test output was removed since it exceeds the threshold " + "of " << length << " bytes.\n"; + output += msg.str(); return true; } @@ -2120,6 +2103,7 @@ bool cmCTestTestHandler::SetTestsProperties( if ( key == "TIMEOUT" ) { rtit->Timeout = atof(val.c_str()); + rtit->ExplicitTimeout = true; } if ( key == "COST" ) { @@ -2190,7 +2174,6 @@ bool cmCTestTestHandler::SetTestsProperties( { rtit->Labels.push_back(*crit); } - } if ( key == "MEASUREMENT" ) { @@ -2219,6 +2202,10 @@ bool cmCTestTestHandler::SetTestsProperties( std::string(crit->c_str()))); } } + if ( key == "WORKING_DIRECTORY" ) + { + rtit->Directory = val; + } } } } @@ -2290,6 +2277,7 @@ bool cmCTestTestHandler::AddTest(const std::vector& args) test.WillFail = false; test.RunSerial = false; test.Timeout = 0; + test.ExplicitTimeout = false; test.Cost = 0; test.Processors = 1; test.PreviousRuns = 0; diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 704956468..7aa8522e9 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -99,6 +99,7 @@ public: int PreviousRuns; bool RunSerial; double Timeout; + bool ExplicitTimeout; int Index; //Requested number of process slots int Processors; diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index f9ad79a0c..fbee2272e 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -228,6 +228,11 @@ void cmCTestVC::WriteXMLEntry(std::ostream& xml, << "\t\t\t" << cmXMLSafe(rev.Date) << "\n" << "\t\t\t" << cmXMLSafe(rev.Author) << "\n" << "\t\t\t" << cmXMLSafe(rev.EMail) << "\n" + << "\t\t\t" << cmXMLSafe(rev.Committer) << "\n" + << "\t\t\t" << cmXMLSafe(rev.CommitterEMail) + << "\n" + << "\t\t\t" << cmXMLSafe(rev.CommitDate) + << "\n" << "\t\t\t" << cmXMLSafe(rev.Log) << "\n" << "\t\t\t" << cmXMLSafe(rev.Rev) << "\n" << "\t\t\t" << cmXMLSafe(prior) << "\n" diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index d36bc8fa9..44e1dacbb 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -74,6 +74,9 @@ protected: std::string Date; std::string Author; std::string EMail; + std::string Committer; + std::string CommitterEMail; + std::string CommitDate; std::string Log; }; diff --git a/Source/CursesDialog/form/frm_driver.c b/Source/CursesDialog/form/frm_driver.c index 0b53b5a2f..03896c29f 100644 --- a/Source/CursesDialog/form/frm_driver.c +++ b/Source/CursesDialog/form/frm_driver.c @@ -357,8 +357,12 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win) assert(win && field); +#if defined(__LSB_VERSION__) + getmaxyx(win, height, width); +#else width = getmaxx(win); height = getmaxy(win); +#endif for(row=0, pBuffer=field->buf; row < height; @@ -396,7 +400,11 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field) pad = field->pad; p = field->buf; +#if defined(__LSB_VERSION__) + { int width; getmaxyx(win, height, width); } +#else height = getmaxy(win); +#endif for(row=0; (row < height) && (row < field->drows); row++ ) { @@ -871,7 +879,17 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) if (field->opts & O_VISIBLE) Set_Field_Window_Attributes(field,win); else + { +#if defined(__LSB_VERSION__) + /* getattrs() would be handy, but it is not part of LSB 4.0 */ + attr_t fwinAttrs; + short fwinPair; + wattr_get(fwin, &fwinAttrs, &fwinPair, 0); + wattr_set(win, fwinAttrs, fwinPair, 0); +#else wattrset(win,getattrs(fwin)); +#endif + } werase(win); } diff --git a/Source/CursesDialog/form/frm_post.c b/Source/CursesDialog/form/frm_post.c index 5ead942f0..3c63de70e 100644 --- a/Source/CursesDialog/form/frm_post.c +++ b/Source/CursesDialog/form/frm_post.c @@ -51,6 +51,7 @@ int post_form(FORM * form) WINDOW *formwin; int err; int page; + int height, width; if (!form) RETURN(E_BAD_ARGUMENT); @@ -62,7 +63,13 @@ int post_form(FORM * form) RETURN(E_NOT_CONNECTED); formwin = Get_Form_Window(form); - if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) +#if defined(__LSB_VERSION__) + getmaxyx(formwin, height, width); +#else + width = getmaxx(formwin); + height = getmaxy(formwin); +#endif + if ((form->cols > width) || (form->rows > height)) RETURN(E_NO_ROOM); /* reset form->curpage to an invald value. This forces Set_Form_Page diff --git a/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake b/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake deleted file mode 100644 index 9f5cf0010..000000000 --- a/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake +++ /dev/null @@ -1,347 +0,0 @@ -# -# CMakeIngestOSXBundleLibraries.cmake -# -# Only for the Mac build. -# -# Depends on OS tools: -# otool -# install_name_tool -# -# This script ingests libraries and frameworks into an existing .app bundle and -# then uses install_name_tool to fixup the references to the newly embedded -# libraries so that they all refer to each other via "@executable_path." -# -# The main intent (and simplifying assumption used for developing the script) -# is to have a single executable .app bundle that becomes "self-contained" by -# copying all non-system libs that it depends on into itself. The further -# assumption is that all such dependencies are simple .dylib shared library -# files or Mac Framework libraries. -# -# This script can be used as part of the build via ADD_CUSTOM_COMMAND, or used -# only during make install via INSTALL SCRIPT. -# -if(NOT DEFINED input_file) - message(FATAL_ERROR " -${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable input_file is not defined. - -Use a command line like this to use this script: - cmake \"-Dinput_file=filename\" \"-Dextra_libs=/path/to/lib1;/path/to/lib2\" \"-Dlib_path=/path/to/unqualified/libs\" -P \"${CMAKE_CURRENT_LIST_FILE}\" - -'input_file' should be the main executable inside a Mac bundle directory structure. -For example, use 'bin/paraview.app/Contents/MacOS/paraview' from a ParaView binary dir. - -'extra_libs' should be a semi-colon separated list of full path names to extra libraries -to copy into the bundle that cannot be derived from otool -L output. For example, you may -also want to fixup dynamically loaded plugins from your build tree and copy them into the -bundle. - -'lib_path' should be the path where to find libraries referenced without a path name in -otool -L output. - -") -endif(NOT DEFINED input_file) -message("ingest ${input_file}") -set(eol_char "E") - -if(APPLE) - set(dep_tool "otool") - set(dep_cmd_args "-L") - set(dep_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$") -endif(APPLE) - -message("") -message("# Script \"${CMAKE_CURRENT_LIST_FILE}\" running...") -message("") -message("input_file: '${input_file}'") -message("extra_libs: '${extra_libs}'") -message("lib_path: '${lib_path}'") -message("") - -get_filename_component(input_file_full "${input_file}" ABSOLUTE) -message("input_file_full: '${input_file_full}'") - -get_filename_component(bundle "${input_file_full}/../../.." ABSOLUTE) -message("bundle: '${bundle}'") - - -find_program(dep_cmd ${dep_tool}) - -# find the full path to the framework in path set the result -# in pathout -macro(find_framework_full_path path pathout) - set(${pathout} "${path}") - if(NOT EXISTS "${path}") - set(FRAMEWORK_SEARCH "/Library/Frameworks" - "/System/Library/Frameworks" ) - set(__FOUND FALSE) - foreach(f ${FRAMEWORK_SEARCH}) - set(newd "${f}/${path}") - if(EXISTS "${newd}" AND NOT __FOUND) - set(${pathout} "${newd}") - set(__FOUND TRUE) - endif(EXISTS "${newd}" AND NOT __FOUND) - endforeach(f) - endif(NOT EXISTS "${path}") -endmacro(find_framework_full_path) - - -macro(append_unique au_list_var au_value) - set(${au_list_var} ${${au_list_var}} "${au_value}") -endmacro(append_unique) - - -macro(gather_dependents gd_target gd_dependents_var) - execute_process( - COMMAND ${dep_cmd} ${dep_cmd_args} ${gd_target} - OUTPUT_VARIABLE dep_tool_ov - ) - - string(REGEX REPLACE ";" "\\\\;" dep_candidates "${dep_tool_ov}") - string(REGEX REPLACE "\n" "${eol_char};" dep_candidates "${dep_candidates}") - - set(${gd_dependents_var} "") - - foreach(candidate ${dep_candidates}) - if("${candidate}" MATCHES "${dep_regex}") - string(REGEX REPLACE "${dep_regex}" "\\1" raw_item "${candidate}") - string(REGEX REPLACE "${dep_regex}" "\\2" raw_compat_version "${candidate}") - string(REGEX REPLACE "${dep_regex}" "\\3" raw_current_version "${candidate}") - - set(item "${raw_item}") - - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}") - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}") - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}") - - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}") - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}") - string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}") - - #message("${raw_item} - compat ${raw_compat_version} - current ${raw_current_version}") - append_unique("${gd_dependents_var}" "${item}") - else("${candidate}" MATCHES "${dep_regex}") - if("${candidate}" STREQUAL "${gd_target}:${eol_char}") - #message("info: ignoring target name...") - else("${candidate}" STREQUAL "${gd_target}:${eol_char}") - message("error: candidate='${candidate}'") - endif("${candidate}" STREQUAL "${gd_target}:${eol_char}") - endif("${candidate}" MATCHES "${dep_regex}") - endforeach(candidate) -endmacro(gather_dependents) - - -message("Gathering dependent libraries for '${input_file_full}'...") -gather_dependents("${input_file_full}" deps) -message("") - - -# Order lexicographically: -# -list(SORT deps) - - -# Split into separate lists, "system" "embedded" and "nonsystem" libraries. -# System libs are assumed to be available on all target runtime Macs and do not -# need to be copied/fixed-up by this script. Embedded libraries are assumed to -# be in the bundle and fixed-up already. Only non-system, non-embedded libs -# need copying and fixing up... -# -set(system_deps "") -set(embedded_deps "") -set(nonsystem_deps "") - -foreach(d ${deps}) - set(d_is_embedded_lib 0) - set(d_is_system_lib 0) - - if("${d}" MATCHES "^(/System/Library|/usr/lib)") - set(d_is_system_lib 1) - else("${d}" MATCHES "^(/System/Library|/usr/lib)") - if("${d}" MATCHES "^@executable_path") - set(d_is_embedded_lib 1) - endif("${d}" MATCHES "^@executable_path") - endif("${d}" MATCHES "^(/System/Library|/usr/lib)") - - if(d_is_system_lib) - set(system_deps ${system_deps} "${d}") - else(d_is_system_lib) - if(d_is_embedded_lib) - set(embedded_deps ${embedded_deps} "${d}") - else(d_is_embedded_lib) - set(nonsystem_deps ${nonsystem_deps} "${d}") - endif(d_is_embedded_lib) - endif(d_is_system_lib) -endforeach(d) - -message("") -message("system_deps:") -foreach(d ${system_deps}) - message("${d}") -endforeach(d ${system_deps}) - -message("") -message("embedded_deps:") -foreach(d ${embedded_deps}) - message("${d}") -endforeach(d ${embedded_deps}) - -message("") -message("nonsystem_deps:") -foreach(d ${nonsystem_deps}) - message("${d}") -endforeach(d ${nonsystem_deps}) - -message("") - - -macro(copy_library_into_bundle clib_bundle clib_libsrc clib_dstlibs clib_fixups) - # - # If the source library is a framework, copy just the shared lib bit of the framework - # into the bundle under "${clib_bundle}/Contents/Frameworks" - if it is just a dylib - # copy it into the same directory with the main bundle executable under - # "${clib_bundle}/Contents/MacOS" - # - if("${clib_libsrc}" MATCHES ".framework/.*/.*/.*") - # make sure clib_libsrc is a full path to the framework as a framework - # maybe linked in with relative paths in some cases - find_framework_full_path("${clib_libsrc}" fw_full_src) - get_filename_component(fw_src "${fw_full_src}" ABSOLUTE) - get_filename_component(fw_srcdir "${clib_libsrc}/../../.." ABSOLUTE) - get_filename_component(fwdirname "${fw_srcdir}" NAME) - string(REGEX REPLACE "^(.*)\\.framework$" "\\1" fwname "${fwdirname}") - string(REGEX REPLACE "^.*/${fwname}\\.framework/(.*)$" "\\1" fwlibname "${clib_libsrc}") - set(fw_dstdir "${clib_bundle}/Contents/Frameworks") - -# message("") -# message("fwdirname: '${fwdirname}'") -# message("fwname: '${fwname}'") -# message("fwlibname: '${fwlibname}'") -# message("fw_src: '${fw_src}'") -# message("fw_srcdir: '${fw_srcdir}'") -# message("fw_dstdir: '${fw_dstdir}'") -# message("new_name: '@executable_path/../Frameworks/${fwdirname}/${fwlibname}'") -# message("") - - message("Copying ${fw_srcdir} into bundle...") - - # This command copies the *entire* framework recursively: - # -# execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory -# "${fw_srcdir}" "${fw_dstdir}" -# ) - - # This command copies just the main shared lib of the framework: - # (This technique will not work for frameworks that have necessary - # resource or auxiliary files...) - # - message("fw_src = [${fw_src}] fw_full_src = [${fw_full_src}]") - message("Copy: ${CMAKE_COMMAND} -E copy \"${fw_src}\" \"${fw_dstdir}/${fwlibname}\"") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy - "${fw_src}" "${fw_dstdir}/${fwlibname}" - ) - - get_filename_component(fw_src_path "${fw_src}" PATH) - message("Checking ${fw_src_path}/Resources") - if(EXISTS "${fw_src_path}/Resources") - message("Copy: ${CMAKE_COMMAND} -E copy_directory \"${fw_src_path}/Resources/\" \"${fw_dstdir}/Resources/\"") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory - "${fw_src_path}/Resources/" "${fw_dstdir}/${fwdirname}/Resources/") - endif(EXISTS "${fw_src_path}/Resources") - - execute_process(COMMAND install_name_tool - -id "@executable_path/../Frameworks/${fwlibname}" - "${clib_bundle}/Contents/Frameworks/${fwlibname}" - ) - set(${clib_dstlibs} ${${clib_dstlibs}} - "${clib_bundle}/Contents/Frameworks/${fwlibname}" - ) - set(${clib_fixups} ${${clib_fixups}} - "-change" - "${clib_libsrc}" - "@executable_path/../Frameworks/${fwlibname}" - ) - else("${clib_libsrc}" MATCHES ".framework/.*/.*/.*") - if("${clib_libsrc}" MATCHES "/") - set(clib_libsrcfull "${clib_libsrc}") - else("${clib_libsrc}" MATCHES "/") - set(clib_libsrcfull "${lib_path}/${clib_libsrc}") - if(NOT EXISTS "${clib_libsrcfull}") - message(FATAL_ERROR "error: '${clib_libsrcfull}' does not exist...") - endif(NOT EXISTS "${clib_libsrcfull}") - endif("${clib_libsrc}" MATCHES "/") - - get_filename_component(dylib_src "${clib_libsrcfull}" ABSOLUTE) - get_filename_component(dylib_name "${dylib_src}" NAME) - set(dylib_dst "${clib_bundle}/Contents/MacOS/${dylib_name}") - -# message("dylib_src: ${dylib_src}") -# message("dylib_dst: ${dylib_dst}") -# message("new_name: '@executable_path/${dylib_name}'") - - message("Copying ${dylib_src} into bundle...") - execute_process(COMMAND ${CMAKE_COMMAND} -E copy - "${dylib_src}" "${dylib_dst}") - execute_process(COMMAND install_name_tool - -id "@executable_path/${dylib_name}" - "${dylib_dst}" - ) - set(${clib_dstlibs} ${${clib_dstlibs}} - "${dylib_dst}" - ) - set(${clib_fixups} ${${clib_fixups}} - "-change" - "${clib_libsrc}" - "@executable_path/${dylib_name}" - ) - endif("${clib_libsrc}" MATCHES ".framework/.*/.*/.*") -endmacro(copy_library_into_bundle) - - -# Copy dependent "nonsystem" libraries into the bundle: -# -message("Copying dependent libraries into bundle...") -set(srclibs ${nonsystem_deps} ${extra_libs}) -set(dstlibs "") -set(fixups "") -foreach(d ${srclibs}) - message("copy it --- ${d}") - copy_library_into_bundle("${bundle}" "${d}" dstlibs fixups) -endforeach(d) - -message("") -message("dstlibs='${dstlibs}'") -message("") -message("fixups='${fixups}'") -message("") - - -# Fixup references to copied libraries in the main bundle executable and in the -# copied libraries themselves: -# -if(NOT "${fixups}" STREQUAL "") - message("Fixing up references...") - foreach(d ${dstlibs} "${input_file_full}") - message("fixing up references in: '${d}'") - execute_process(COMMAND install_name_tool ${fixups} "${d}") - endforeach(d) - message("") -endif(NOT "${fixups}" STREQUAL "") - - -# List all references to eyeball them and make sure they look right: -# -message("Listing references...") -foreach(d ${dstlibs} "${input_file_full}") - execute_process(COMMAND otool -L "${d}") - message("") -endforeach(d) -message("") - - -# Output file: -# -#get_filename_component(script_name "${CMAKE_CURRENT_LIST_FILE}" NAME) -#file(WRITE "${input_file_full}_${script_name}" "# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.\n") -message("") -message("# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.") -message("") diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 405c9522e..4785188f0 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -19,13 +19,6 @@ ELSE(NOT QT4_FOUND) INCLUDE(${QT_USE_FILE}) SET(CMAKE_PACKAGE_QTGUI TRUE) - # i don't want to install or package the qt gui on windows - # unless qt is static - IF(WIN32 AND NOT QT_CONFIG MATCHES "static") - SET(CMAKE_PACKAGE_QTGUI FALSE) - MESSAGE(STATUS - "WARNING: QtDialog requires a static built qt for installation.") - ENDIF(WIN32 AND NOT QT_CONFIG MATCHES "static") SET(SRCS AddCacheEntry.cxx AddCacheEntry.h @@ -86,12 +79,8 @@ ELSE(NOT QT4_FOUND) SET(CMAKE_INSTALL_DESTINATION_ARGS BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) - # if qt is not static and we are on windows then skip the install - # I don't want to distribute qt dlls - IF(CMAKE_PACKAGE_QTGUI) - INSTALL(TARGETS cmake-gui RUNTIME DESTINATION bin - ${CMAKE_INSTALL_DESTINATION_ARGS}) - ENDIF(CMAKE_PACKAGE_QTGUI) + + INSTALL(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) IF(UNIX) # install a desktop file so CMake appears in the application start menu @@ -112,10 +101,21 @@ ELSE(NOT QT4_FOUND) "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") INSTALL(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") - INSTALL(CODE "set(input_file - \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}\")") - INSTALL(SCRIPT "${CMake_SOURCE_DIR}/Source/QtDialog/CMakeIngestOSXBundleLibraries.cmake") ENDIF(APPLE) + + if(APPLE OR WIN32) + # install rules for including 3rd party libs such as Qt + # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") + endif(APPLE) + install(CODE " + include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") + fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") + ") + endif(APPLE OR WIN32) + CONFIGURE_FILE("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) ENDIF(NOT QT4_FOUND) diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx index 28f4697d0..7ba7f51ec 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -165,13 +165,25 @@ int main(int argc, char** argv) if(args.count() == 2) { cmsys_stl::string filePath = cmSystemTools::CollapseFullPath(args[1].toAscii().data()); + + // check if argument is a directory containing CMakeCache.txt cmsys_stl::string buildFilePath = cmSystemTools::CollapseFullPath("CMakeCache.txt", filePath.c_str()); + + // check if argument is a CMakeCache.txt file + if(cmSystemTools::GetFilenameName(filePath) == "CMakeCache.txt" && + cmSystemTools::FileExists(filePath.c_str())) + { + buildFilePath = filePath; + } + + // check if argument is a directory containing CMakeLists.txt cmsys_stl::string srcFilePath = cmSystemTools::CollapseFullPath("CMakeLists.txt", filePath.c_str()); + if(cmSystemTools::FileExists(buildFilePath.c_str())) { - dialog.setBinaryDirectory(filePath.c_str()); + dialog.setBinaryDirectory(cmSystemTools::GetFilenamePath(buildFilePath).c_str()); } else if(cmSystemTools::FileExists(srcFilePath.c_str())) { diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 29fcfc0ee..408dbacbd 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -55,7 +55,7 @@ void QCMakeThread::run() } CMakeSetupDialog::CMakeSetupDialog() - : ExitAfterGenerate(true), CacheModified(false), CurrentState(Interrupting) + : ExitAfterGenerate(true), CacheModified(false), ConfigureNeeded(true), CurrentState(Interrupting) { QString title = QString(tr("CMake %1")); title = title.arg(cmVersion::GetCMakeVersion()); @@ -167,6 +167,9 @@ CMakeSetupDialog::CMakeSetupDialog() this->CMakeThread->start(); this->enterState(ReadyConfigure); + + ProgressOffset = 0.0; + ProgressFactor = 1.0; } void CMakeSetupDialog::initialize() @@ -179,12 +182,11 @@ void CMakeSetupDialog::initialize() QObject::connect(this->ConfigureButton, SIGNAL(clicked(bool)), this, SLOT(doConfigure())); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(configureDone(int)), - this, SLOT(finishConfigure(int))); - QObject::connect(this->CMakeThread->cmakeInstance(), - SIGNAL(generateDone(int)), - this, SLOT(finishGenerate(int))); + + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(configureDone(int)), + this, SLOT(exitLoop(int))); + QObject::connect(this->CMakeThread->cmakeInstance(), SIGNAL(generateDone(int)), + this, SLOT(exitLoop(int))); QObject::connect(this->GenerateButton, SIGNAL(clicked(bool)), this, SLOT(doGenerate())); @@ -270,15 +272,8 @@ CMakeSetupDialog::~CMakeSetupDialog() this->CMakeThread->wait(2000); } -void CMakeSetupDialog::doConfigure() +bool CMakeSetupDialog::prepareConfigure() { - if(this->CurrentState == Configuring) - { - // stop configure - doInterrupt(); - return; - } - // make sure build directory exists QString bindir = this->CMakeThread->cmakeInstance()->binaryDirectory(); QDir dir(bindir); @@ -295,7 +290,7 @@ void CMakeSetupDialog::doConfigure() QMessageBox::Yes | QMessageBox::No); if(btn == QMessageBox::No) { - return; + return false; } if(!dir.mkpath(".")) { @@ -303,7 +298,7 @@ void CMakeSetupDialog::doConfigure() QString(tr("Failed to create directory %1")).arg(dir.path()), QMessageBox::Ok); - return; + return false; } } @@ -312,27 +307,45 @@ void CMakeSetupDialog::doConfigure() { if(!this->setupFirstConfigure()) { - return; + return false; } } // remember path this->addBinaryPath(dir.absolutePath()); - this->enterState(Configuring); + return true; +} - this->CacheValues->selectionModel()->clear(); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "setProperties", Qt::QueuedConnection, - Q_ARG(QCMakePropertyList, - this->CacheValues->cacheModel()->properties())); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "configure", Qt::QueuedConnection); +void CMakeSetupDialog::exitLoop(int err) +{ + this->LocalLoop.exit(err); } -void CMakeSetupDialog::finishConfigure(int err) +void CMakeSetupDialog::doConfigure() { - if(0 == err && !this->CacheValues->cacheModel()->newPropertyCount()) + if(this->CurrentState == Configuring) + { + // stop configure + doInterrupt(); + return; + } + + if(!prepareConfigure()) + { + return; + } + + this->enterState(Configuring); + + bool ret = doConfigureInternal(); + + if(ret) + { + this->ConfigureNeeded = false; + } + + if(ret && !this->CacheValues->cacheModel()->newPropertyCount()) { this->enterState(ReadyGenerate); } @@ -341,6 +354,22 @@ void CMakeSetupDialog::finishConfigure(int err) this->enterState(ReadyConfigure); this->CacheValues->scrollToTop(); } + this->ProgressBar->reset(); +} + +bool CMakeSetupDialog::doConfigureInternal() +{ + this->Output->clear(); + this->CacheValues->selectionModel()->clear(); + + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "setProperties", Qt::QueuedConnection, + Q_ARG(QCMakePropertyList, + this->CacheValues->cacheModel()->properties())); + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "configure", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); if(err != 0) { @@ -348,23 +377,31 @@ void CMakeSetupDialog::finishConfigure(int err) tr("Error in configuration process, project files may be invalid"), QMessageBox::Ok); } + + return 0 == err; } -void CMakeSetupDialog::finishGenerate(int err) +void CMakeSetupDialog::doInstallForCommandLine() { - this->enterState(ReadyConfigure); + QMacInstallDialog setupdialog(0); + setupdialog.exec(); +} + +bool CMakeSetupDialog::doGenerateInternal() +{ + QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), + "generate", Qt::QueuedConnection); + + int err = this->LocalLoop.exec(); + if(err != 0) { QMessageBox::critical(this, tr("Error"), tr("Error in generation process, project files may be invalid"), QMessageBox::Ok); } -} -void CMakeSetupDialog::doInstallForCommandLine() -{ - QMacInstallDialog setupdialog(0); - setupdialog.exec(); + return 0 == err; } void CMakeSetupDialog::doGenerate() @@ -375,9 +412,43 @@ void CMakeSetupDialog::doGenerate() doInterrupt(); return; } + + // see if we need to configure + // we'll need to configure if: + // the configure step hasn't been done yet + // generate was the last step done + if(this->ConfigureNeeded) + { + if(!prepareConfigure()) + { + return; + } + } + this->enterState(Generating); - QMetaObject::invokeMethod(this->CMakeThread->cmakeInstance(), - "generate", Qt::QueuedConnection); + + bool config_passed = true; + if(this->ConfigureNeeded) + { + this->CacheValues->cacheModel()->setShowNewProperties(false); + this->ProgressFactor = 0.5; + config_passed = doConfigureInternal(); + this->ProgressOffset = 0.5; + } + + if(config_passed) + { + doGenerateInternal(); + } + + this->ProgressOffset = 0.0; + this->ProgressFactor = 1.0; + this->CacheValues->cacheModel()->setShowNewProperties(true); + + this->enterState(ReadyConfigure); + this->ProgressBar->reset(); + + this->ConfigureNeeded = true; } void CMakeSetupDialog::closeEvent(QCloseEvent* e) @@ -542,6 +613,7 @@ void CMakeSetupDialog::setSourceDirectory(const QString& dir) void CMakeSetupDialog::showProgress(const QString& /*msg*/, float percent) { + percent = (percent * ProgressFactor) + ProgressOffset; this->ProgressBar->setValue(qRound(percent * 100)); } @@ -883,7 +955,6 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == Configuring) { - this->Output->clear(); this->setEnabledState(false); this->GenerateButton->setEnabled(false); this->GenerateAction->setEnabled(false); @@ -899,17 +970,15 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s) } else if(s == ReadyConfigure) { - this->ProgressBar->reset(); this->setEnabledState(true); - this->GenerateButton->setEnabled(false); - this->GenerateAction->setEnabled(false); + this->GenerateButton->setEnabled(true); + this->GenerateAction->setEnabled(true); this->ConfigureButton->setEnabled(true); this->ConfigureButton->setText(tr("&Configure")); this->GenerateButton->setText(tr("&Generate")); } else if(s == ReadyGenerate) { - this->ProgressBar->reset(); this->setEnabledState(true); this->GenerateButton->setEnabled(true); this->GenerateAction->setEnabled(true); diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 0e3caec44..193479571 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -16,6 +16,7 @@ #include "QCMake.h" #include #include +#include #include "ui_CMakeSetupDialog.h" class QCMakeThread; @@ -43,8 +44,6 @@ protected slots: void doHelp(); void doAbout(); void doInterrupt(); - void finishConfigure(int error); - void finishGenerate(int error); void error(const QString& message); void message(const QString& message); @@ -74,6 +73,10 @@ protected slots: void setGroupedView(bool); void showUserChanges(); void setSearchFilter(const QString& str); + bool prepareConfigure(); + bool doConfigureInternal(); + bool doGenerateInternal(); + void exitLoop(int); protected: @@ -87,6 +90,7 @@ protected: QCMakeThread* CMakeThread; bool ExitAfterGenerate; bool CacheModified; + bool ConfigureNeeded; QAction* ReloadCacheAction; QAction* DeleteCacheAction; QAction* ExitAction; @@ -99,6 +103,10 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; + QEventLoop LocalLoop; + + float ProgressOffset; + float ProgressFactor; }; // QCMake instance on a thread diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index d90307ad0..562396ddc 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -200,6 +200,7 @@ QCMakeCacheModel::QCMakeCacheModel(QObject* p) NewPropertyCount(0), View(FlatView) { + this->ShowNewProperties = true; QStringList labels; labels << tr("Name") << tr("Value"); this->setHorizontalHeaderLabels(labels); @@ -214,6 +215,11 @@ static uint qHash(const QCMakeProperty& p) return qHash(p.Key); } +void QCMakeCacheModel::setShowNewProperties(bool f) +{ + this->ShowNewProperties = f; +} + void QCMakeCacheModel::clear() { this->QStandardItemModel::clear(); @@ -226,13 +232,21 @@ void QCMakeCacheModel::clear() void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) { - QSet newProps = props.toSet(); - QSet newProps2 = newProps; - QSet oldProps = this->properties().toSet(); - - oldProps.intersect(newProps); - newProps.subtract(oldProps); - newProps2.subtract(newProps); + QSet newProps, newProps2; + + if(this->ShowNewProperties) + { + newProps = props.toSet(); + newProps2 = newProps; + QSet oldProps = this->properties().toSet(); + oldProps.intersect(newProps); + newProps.subtract(oldProps); + newProps2.subtract(newProps); + } + else + { + newProps2 = props.toSet(); + } bool b = this->blockSignals(true); diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h index 401e07e28..58bbd2d28 100644 --- a/Source/QtDialog/QCMakeCacheView.h +++ b/Source/QtDialog/QCMakeCacheView.h @@ -78,6 +78,9 @@ public slots: // become new properties and be marked red. void setProperties(const QCMakePropertyList& props); + // set whether to show new properties in red + void setShowNewProperties(bool); + // clear everything from the model void clear(); @@ -115,6 +118,7 @@ public: protected: bool EditEnabled; int NewPropertyCount; + bool ShowNewProperties; ViewType View; // set the data in the model for this property diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx index f6b3234de..7af6ec8d7 100644 --- a/Source/cmAddCustomCommandCommand.cxx +++ b/Source/cmAddCustomCommandCommand.cxx @@ -161,6 +161,7 @@ bool cmAddCustomCommandCommand filename += "/"; } filename += copy; + cmSystemTools::ConvertToUnixSlashes(filename); break; case doing_source: // We do not want to convert the argument to SOURCE because diff --git a/Source/cmAddCustomCommandCommand.h b/Source/cmAddCustomCommandCommand.h index c67caa545..490e043ae 100644 --- a/Source/cmAddCustomCommandCommand.h +++ b/Source/cmAddCustomCommandCommand.h @@ -13,6 +13,7 @@ #define cmAddCustomCommandCommand_h #include "cmCommand.h" +#include "cmDocumentGeneratorExpressions.h" /** \class cmAddCustomCommandCommand * \brief @@ -146,12 +147,22 @@ public: "target-level dependency will be added so that the executable target " "will be built before any target using this custom command. However " "this does NOT add a file-level dependency that would cause the " - "custom command to re-run whenever the executable is recompiled.\n" - + "custom command to re-run whenever the executable is recompiled." + "\n" + "Arguments to COMMAND may use \"generator expressions\" with the " + "syntax \"$<...>\". " + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS + "References to target names in generator expressions imply " + "target-level dependencies, but NOT file-level dependencies. " + "List target names with the DEPENDS option to add file dependencies." + "\n" "The DEPENDS option specifies files on which the command depends. " "If any dependency is an OUTPUT of another custom command in the " "same directory (CMakeLists.txt file) CMake automatically brings the " "other custom command into the target in which this command is built. " + "If DEPENDS is not specified the command will run whenever the OUTPUT " + "is missing; if the command does not actually create the OUTPUT then " + "the rule will always run. " "If DEPENDS specifies any target (created by an ADD_* command) " "a target-level dependency is created to make sure the target is " "built before any target using this custom command. Additionally, " diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx index 1205f0741..a77140d61 100644 --- a/Source/cmAddDependenciesCommand.cxx +++ b/Source/cmAddDependenciesCommand.cxx @@ -24,11 +24,7 @@ bool cmAddDependenciesCommand } std::string target_name = args[0]; - - cmTarget* target = - this->GetMakefile()->GetLocalGenerator()-> - GetGlobalGenerator()->FindTarget(0, target_name.c_str()); - if(target) + if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str())) { std::vector::const_iterator s = args.begin(); ++s; // skip over target_name diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index 6a981c36e..fee011c22 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -62,6 +62,8 @@ public: "top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, " "or ADD_CUSTOM_TARGET. Adding dependencies with this command " "can be used to make sure one target is built before another target. " + "Dependencies added to an IMPORTED target are followed transitively " + "in its place since the target itself does not build. " "See the DEPENDS option of ADD_CUSTOM_TARGET " "and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom " "rules. See the OBJECT_DEPENDS option in " diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx index 923206d85..11ca9e7cc 100644 --- a/Source/cmAddTestCommand.cxx +++ b/Source/cmAddTestCommand.cxx @@ -74,6 +74,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) { std::string name; std::vector configurations; + std::string working_directory; std::vector command; // Read the arguments. @@ -81,6 +82,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) DoingName, DoingCommand, DoingConfigs, + DoingWorkingDirectory, DoingNone }; Doing doing = DoingName; @@ -104,6 +106,15 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) } doing = DoingConfigs; } + else if(args[i] == "WORKING_DIRECTORY") + { + if(!working_directory.empty()) + { + this->SetError(" may be given at most one WORKING_DIRECTORY."); + return false; + } + doing = DoingWorkingDirectory; + } else if(doing == DoingName) { name = args[i]; @@ -117,6 +128,11 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) { configurations.push_back(args[i]); } + else if(doing == DoingWorkingDirectory) + { + working_directory = args[i]; + doing = DoingNone; + } else { cmOStringStream e; @@ -154,6 +170,7 @@ bool cmAddTestCommand::HandleNameMode(std::vector const& args) cmTest* test = this->Makefile->CreateTest(name.c_str()); test->SetOldStyle(false); test->SetCommand(command); + test->SetProperty("WORKING_DIRECTORY", working_directory.c_str()); this->Makefile->AddTestGenerator(new cmTestGenerator(test, configurations)); return true; diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h index 79fb48150..edaf12c9d 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -13,6 +13,7 @@ #define cmAddTestCommand_h #include "cmCommand.h" +#include "cmDocumentGeneratorExpressions.h" /** \class cmAddTestCommand * \brief Add a test to the lists of tests to run. @@ -68,28 +69,19 @@ public: "in the binary tree.\n" "\n" " add_test(NAME [CONFIGURATIONS [Debug|Release|...]]\n" + " [WORKING_DIRECTORY dir]\n" " COMMAND [arg1 [arg2 ...]])\n" "If COMMAND specifies an executable target (created by " "add_executable) it will automatically be replaced by the location " "of the executable created at build time. " "If a CONFIGURATIONS option is given then the test will be executed " - "only when testing under one of the named configurations." + "only when testing under one of the named configurations. " + "If a WORKING_DIRECTORY option is given then the test will be executed " + "in the given directory." "\n" "Arguments after COMMAND may use \"generator expressions\" with the " "syntax \"$<...>\". " - "These expressions are evaluted during build system generation and " - "produce information specific to each generated build configuration. " - "Valid expressions are:\n" - " $ = configuration name\n" - " $ = main file (.exe, .so.1.2, .a)\n" - " $ = file used to link (.a, .lib, .so)\n" - " $ = file with soname (.so.3)\n" - "where \"tgt\" is the name of a target. " - "Target file expressions produce a full path, but _DIR and _NAME " - "versions can produce the directory and file name components:\n" - " $/$\n" - " $/$\n" - " $/$\n" + CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS "Example usage:\n" " add_test(NAME mytest\n" " COMMAND testDriver --config $\n" diff --git a/Source/cmBootstrapCommands.cxx b/Source/cmBootstrapCommands.cxx index db01688e1..554f45215 100644 --- a/Source/cmBootstrapCommands.cxx +++ b/Source/cmBootstrapCommands.cxx @@ -32,6 +32,7 @@ #include "cmCreateTestSourceList.cxx" #include "cmDefinePropertyCommand.cxx" #include "cmElseCommand.cxx" +#include "cmEnableLanguageCommand.cxx" #include "cmEnableTestingCommand.cxx" #include "cmEndForEachCommand.cxx" #include "cmEndFunctionCommand.cxx" @@ -109,6 +110,7 @@ void GetBootstrapCommands(std::list& commands) commands.push_back(new cmCreateTestSourceList); commands.push_back(new cmDefinePropertyCommand); commands.push_back(new cmElseCommand); + commands.push_back(new cmEnableLanguageCommand); commands.push_back(new cmEnableTestingCommand); commands.push_back(new cmEndForEachCommand); commands.push_back(new cmEndFunctionCommand); diff --git a/Source/cmCMakePolicyCommand.h b/Source/cmCMakePolicyCommand.h index b3268654b..afd30010f 100644 --- a/Source/cmCMakePolicyCommand.h +++ b/Source/cmCMakePolicyCommand.h @@ -85,7 +85,8 @@ public: "given version of CMake. " "All policies introduced in the specified version or earlier " "will be set to use NEW behavior. " - "All policies introduced after the specified version will be unset. " + "All policies introduced after the specified version will be unset " + "(unless variable CMAKE_POLICY_DEFAULT_CMP sets a default). " "This effectively requests behavior preferred as of a given CMake " "version and tells newer CMake versions to warn about their new " "policies. " diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 2aa623646..c8374db3f 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -93,14 +93,14 @@ bool cmCacheManager::LoadCache(const char* path, return this->LoadCache(path, internal, emptySet, emptySet); } -bool cmCacheManager::ParseEntry(const char* entry, - std::string& var, - std::string& value) +static bool ParseEntryWithoutType(const char* entry, + std::string& var, + std::string& value) { - // input line is: key:type=value + // input line is: key=value static cmsys::RegularExpression reg( - "^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); - // input line is: "key":type=value + "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); + // input line is: "key"=value static cmsys::RegularExpression regQuoted( "^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$"); bool flag = false; @@ -169,6 +169,11 @@ bool cmCacheManager::ParseEntry(const char* entry, value.size() - 2); } + if (!flag) + { + return ParseEntryWithoutType(entry, var, value); + } + return flag; } @@ -336,7 +341,7 @@ bool cmCacheManager::LoadCache(const char* path, std::string("The current CMakeCache.txt directory ") + currentcwd + std::string(" is different than the directory ") + std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) + - std::string(" where CMackeCache.txt was created. This may result " + std::string(" where CMakeCache.txt was created. This may result " "in binaries being created in the wrong place. If you " "are not sure, reedit the CMakeCache.txt"); cmSystemTools::Error(message.c_str()); diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index da1496621..314017bf5 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -139,10 +139,6 @@ public: std::string& value, CacheEntryType& type); - static bool ParseEntry(const char* entry, - std::string& var, - std::string& value); - ///! Get a value from the cache given a key const char* GetCacheValue(const char* key) const; diff --git a/Source/cmCommands.cxx b/Source/cmCommands.cxx index 195087183..bb1e4e286 100644 --- a/Source/cmCommands.cxx +++ b/Source/cmCommands.cxx @@ -14,7 +14,6 @@ #include "cmAuxSourceDirectoryCommand.cxx" #include "cmBuildNameCommand.cxx" #include "cmElseIfCommand.cxx" -#include "cmEnableLanguageCommand.cxx" #include "cmEndWhileCommand.cxx" #include "cmExportCommand.cxx" #include "cmExportLibraryDependencies.cxx" @@ -54,7 +53,6 @@ void GetPredefinedCommands(std::list& commands.push_back(new cmAuxSourceDirectoryCommand); commands.push_back(new cmBuildNameCommand); commands.push_back(new cmElseIfCommand); - commands.push_back(new cmEnableLanguageCommand); commands.push_back(new cmEndWhileCommand); commands.push_back(new cmExportCommand); commands.push_back(new cmExportLibraryDependenciesCommand); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index 1cabed2c5..d53200c87 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -923,7 +923,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo() //---------------------------------------------------------------------------- void cmComputeLinkInformation::AddLinkPrefix(const char* p) { - if(p) + if(p && *p) { this->LinkPrefixes.insert(p); } diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 313c680e5..a4ca363a8 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -144,7 +144,7 @@ bool cmComputeTargetDepends::Compute() //---------------------------------------------------------------------------- void cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t, - std::set& deps) + cmTargetDependSet& deps) { // Lookup the index for this target. All targets should be known by // this point. @@ -156,7 +156,9 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t, EdgeList const& nl = this->FinalGraph[i]; for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni) { - deps.insert(this->Targets[*ni]); + cmTarget* dep = this->Targets[*ni]; + cmTargetDependSet::iterator di = deps.insert(dep).first; + di->SetType(ni->IsStrong()); } } @@ -244,13 +246,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, // Check the target's makefile first. cmTarget* dependee = - depender->GetMakefile()->FindTarget(dependee_name); - - // Then search globally. - if(!dependee) - { - dependee = this->GlobalGenerator->FindTarget(0, dependee_name); - } + depender->GetMakefile()->FindTargetToUse(dependee_name); // Skip targets that will not really be linked. This is probably a // name conflict between an external library and an executable @@ -262,25 +258,42 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index, dependee = 0; } - // If not found then skip then the dependee. - if(!dependee) + if(dependee) { - return; + this->AddTargetDepend(depender_index, dependee, linking); } +} - // No imported targets should have been found. - assert(!dependee->IsImported()); - - // Lookup the index for this target. All targets should be known by - // this point. - std::map::const_iterator tii = - this->TargetIndex.find(dependee); - assert(tii != this->TargetIndex.end()); - int dependee_index = tii->second; - - // Add this entry to the dependency graph. - this->InitialGraph[depender_index].push_back( - cmGraphEdge(dependee_index, !linking)); +//---------------------------------------------------------------------------- +void cmComputeTargetDepends::AddTargetDepend(int depender_index, + cmTarget* dependee, + bool linking) +{ + if(dependee->IsImported()) + { + // Skip imported targets but follow their utility dependencies. + std::set const& utils = dependee->GetUtilities(); + for(std::set::const_iterator i = utils.begin(); + i != utils.end(); ++i) + { + cmTarget* transitive_dependee = + dependee->GetMakefile()->FindTargetToUse(i->c_str()); + this->AddTargetDepend(depender_index, transitive_dependee, false); + } + } + else + { + // Lookup the index for this target. All targets should be known by + // this point. + std::map::const_iterator tii = + this->TargetIndex.find(dependee); + assert(tii != this->TargetIndex.end()); + int dependee_index = tii->second; + + // Add this entry to the dependency graph. + this->InitialGraph[depender_index].push_back( + cmGraphEdge(dependee_index, !linking)); + } } //---------------------------------------------------------------------------- @@ -445,7 +458,7 @@ cmComputeTargetDepends int j = *ei; if(cmap[j] == c && ei->IsStrong()) { - this->FinalGraph[i].push_back(j); + this->FinalGraph[i].push_back(cmGraphEdge(j, true)); if(!this->IntraComponent(cmap, c, j, head, emitted, visited)) { return false; @@ -456,7 +469,7 @@ cmComputeTargetDepends // Prepend to a linear linked-list of intra-component edges. if(*head >= 0) { - this->FinalGraph[i].push_back(*head); + this->FinalGraph[i].push_back(cmGraphEdge(*head, false)); } else { @@ -515,7 +528,7 @@ cmComputeTargetDepends int dependee_component = *ni; int dependee_component_head = this->ComponentHead[dependee_component]; this->FinalGraph[depender_component_tail] - .push_back(dependee_component_head); + .push_back(cmGraphEdge(dependee_component_head, ni->IsStrong())); } } return true; diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h index 240de7670..67bce72d9 100644 --- a/Source/cmComputeTargetDepends.h +++ b/Source/cmComputeTargetDepends.h @@ -21,6 +21,7 @@ class cmComputeComponentGraph; class cmGlobalGenerator; class cmTarget; +class cmTargetDependSet; /** \class cmComputeTargetDepends * \brief Compute global interdependencies among targets. @@ -38,13 +39,14 @@ public: bool Compute(); std::vector const& GetTargets() const { return this->Targets; } - void GetTargetDirectDepends(cmTarget* t, std::set& deps); + void GetTargetDirectDepends(cmTarget* t, cmTargetDependSet& deps); private: void CollectTargets(); void CollectDepends(); void CollectTargetDepends(int depender_index); void AddTargetDepend(int depender_index, const char* dependee_name, bool linking); + void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking); bool ComputeFinalDepends(cmComputeComponentGraph const& ccg); cmGlobalGenerator* GlobalGenerator; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index b8a0c95b1..0fe64ad3b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -169,8 +169,9 @@ int cmCoreTryCompile::TryCompileCode(std::vector const& argv) const char* lang =(this->Makefile->GetCMakeInstance()->GetGlobalGenerator() ->GetLanguageFromExtension(ext.c_str())); const char* def = this->Makefile->GetDefinition("CMAKE_MODULE_PATH"); - fprintf(fout, "cmake_minimum_required(VERSION %u.%u)\n", - cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion()); + fprintf(fout, "cmake_minimum_required(VERSION %u.%u.%u.%u)\n", + cmVersion::GetMajorVersion(), cmVersion::GetMinorVersion(), + cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); @@ -396,28 +397,18 @@ void cmCoreTryCompile::CleanupFiles(const char* binDir) } else { - if(!cmSystemTools::RemoveFile(fullPath.c_str())) + // Sometimes anti-virus software hangs on to new files so we + // cannot delete them immediately. Try a few times. + int tries = 5; + while(!cmSystemTools::RemoveFile(fullPath.c_str()) && + --tries && cmSystemTools::FileExists(fullPath.c_str())) { - bool removed = false; - int numAttempts = 0; - // sometimes anti-virus software hangs on to - // new files and we can not delete them, so try - // 5 times with .5 second delay between tries. - while(!removed && numAttempts < 5) - { - cmSystemTools::Delay(500); - if(cmSystemTools::RemoveFile(fullPath.c_str())) - { - removed = true; - } - numAttempts++; - } - if(!removed) - { - std::string m = "Remove failed on file: "; - m += fullPath; - cmSystemTools::ReportLastSystemError(m.c_str()); - } + cmSystemTools::Delay(500); + } + if(tries == 0) + { + std::string m = "Remove failed on file: " + fullPath; + cmSystemTools::ReportLastSystemError(m.c_str()); } } } diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx index 5db88fa7b..bd860ee6a 100644 --- a/Source/cmCustomCommand.cxx +++ b/Source/cmCustomCommand.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmCustomCommand.h" +#include "cmMakefile.h" + //---------------------------------------------------------------------------- cmCustomCommand::cmCustomCommand() { @@ -28,12 +30,14 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r): Comment(r.Comment), WorkingDirectory(r.WorkingDirectory), EscapeAllowMakeVars(r.EscapeAllowMakeVars), - EscapeOldStyle(r.EscapeOldStyle) + EscapeOldStyle(r.EscapeOldStyle), + Backtrace(new cmListFileBacktrace(*r.Backtrace)) { } //---------------------------------------------------------------------------- -cmCustomCommand::cmCustomCommand(const std::vector& outputs, +cmCustomCommand::cmCustomCommand(cmMakefile* mf, + const std::vector& outputs, const std::vector& depends, const cmCustomCommandLines& commandLines, const char* comment, @@ -45,10 +49,21 @@ cmCustomCommand::cmCustomCommand(const std::vector& outputs, Comment(comment?comment:""), WorkingDirectory(workingDirectory?workingDirectory:""), EscapeAllowMakeVars(false), - EscapeOldStyle(true) + EscapeOldStyle(true), + Backtrace(new cmListFileBacktrace) { this->EscapeOldStyle = true; this->EscapeAllowMakeVars = false; + if(mf) + { + mf->GetBacktrace(*this->Backtrace); + } +} + +//---------------------------------------------------------------------------- +cmCustomCommand::~cmCustomCommand() +{ + delete this->Backtrace; } //---------------------------------------------------------------------------- @@ -130,6 +145,12 @@ void cmCustomCommand::SetEscapeAllowMakeVars(bool b) this->EscapeAllowMakeVars = b; } +//---------------------------------------------------------------------------- +cmListFileBacktrace const& cmCustomCommand::GetBacktrace() const +{ + return *this->Backtrace; +} + //---------------------------------------------------------------------------- cmCustomCommand::ImplicitDependsList const& cmCustomCommand::GetImplicitDepends() const diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h index c9adddf05..dd92e34d7 100644 --- a/Source/cmCustomCommand.h +++ b/Source/cmCustomCommand.h @@ -13,6 +13,8 @@ #define cmCustomCommand_h #include "cmStandardIncludes.h" +class cmMakefile; +class cmListFileBacktrace; /** \class cmCustomCommand * \brief A class to encapsulate a custom command @@ -27,12 +29,15 @@ public: cmCustomCommand(const cmCustomCommand& r); /** Main constructor specifies all information for the command. */ - cmCustomCommand(const std::vector& outputs, + cmCustomCommand(cmMakefile* mf, + const std::vector& outputs, const std::vector& depends, const cmCustomCommandLines& commandLines, const char* comment, const char* workingDirectory); + ~cmCustomCommand(); + /** Get the output file produced by the command. */ const std::vector& GetOutputs() const; @@ -63,6 +68,9 @@ public: bool GetEscapeAllowMakeVars() const; void SetEscapeAllowMakeVars(bool b); + /** Backtrace of the command that created this custom command. */ + cmListFileBacktrace const& GetBacktrace() const; + typedef std::pair ImplicitDependsPair; class ImplicitDependsList: public std::vector {}; void SetImplicitDepends(ImplicitDependsList const&); @@ -78,6 +86,7 @@ private: std::string WorkingDirectory; bool EscapeAllowMakeVars; bool EscapeOldStyle; + cmListFileBacktrace* Backtrace; ImplicitDependsList ImplicitDepends; }; diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx new file mode 100644 index 000000000..a65012905 --- /dev/null +++ b/Source/cmCustomCommandGenerator.cxx @@ -0,0 +1,72 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#include "cmCustomCommandGenerator.h" + +#include "cmMakefile.h" +#include "cmCustomCommand.h" +#include "cmLocalGenerator.h" +#include "cmGeneratorExpression.h" + +//---------------------------------------------------------------------------- +cmCustomCommandGenerator::cmCustomCommandGenerator( + cmCustomCommand const& cc, const char* config, cmMakefile* mf): + CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), + OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), + GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace())) +{ +} + +//---------------------------------------------------------------------------- +cmCustomCommandGenerator::~cmCustomCommandGenerator() +{ + delete this->GE; +} + +//---------------------------------------------------------------------------- +unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const +{ + return static_cast(this->CC.GetCommandLines().size()); +} + +//---------------------------------------------------------------------------- +std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const +{ + std::string const& argv0 = this->CC.GetCommandLines()[c][0]; + cmTarget* target = this->Makefile->FindTargetToUse(argv0.c_str()); + if(target && target->GetType() == cmTarget::EXECUTABLE && + (target->IsImported() || !this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))) + { + return target->GetLocation(this->Config); + } + return this->GE->Process(argv0); +} + +//---------------------------------------------------------------------------- +void +cmCustomCommandGenerator +::AppendArguments(unsigned int c, std::string& cmd) const +{ + cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; + for(unsigned int j=1;j < commandLine.size(); ++j) + { + std::string arg = this->GE->Process(commandLine[j]); + cmd += " "; + if(this->OldStyle) + { + cmd += this->LG->EscapeForShellOldStyle(arg.c_str()); + } + else + { + cmd += this->LG->EscapeForShell(arg.c_str(), this->MakeVars); + } + } +} diff --git a/Source/cmCustomCommandGenerator.h b/Source/cmCustomCommandGenerator.h new file mode 100644 index 000000000..4e89f2731 --- /dev/null +++ b/Source/cmCustomCommandGenerator.h @@ -0,0 +1,40 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#ifndef cmCustomCommandGenerator_h +#define cmCustomCommandGenerator_h + +#include "cmStandardIncludes.h" + +class cmCustomCommand; +class cmMakefile; +class cmLocalGenerator; +class cmGeneratorExpression; + +class cmCustomCommandGenerator +{ + cmCustomCommand const& CC; + const char* Config; + cmMakefile* Makefile; + cmLocalGenerator* LG; + bool OldStyle; + bool MakeVars; + cmGeneratorExpression* GE; +public: + cmCustomCommandGenerator(cmCustomCommand const& cc, const char* config, + cmMakefile* mf); + ~cmCustomCommandGenerator(); + unsigned int GetNumberOfCommands() const; + std::string GetCommand(unsigned int c) const; + void AppendArguments(unsigned int c, std::string& cmd) const; +}; + +#endif diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 69ff85843..19558fa7d 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -25,7 +25,7 @@ cmDepends::cmDepends(cmLocalGenerator* lg, const char* targetDir): Verbose(false), FileComparison(0), TargetDirectory(targetDir), - MaxPath(cmSystemTools::GetMaximumFilePathLength()), + MaxPath(16384), Dependee(new char[MaxPath]), Depender(new char[MaxPath]) { diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h new file mode 100644 index 000000000..535901397 --- /dev/null +++ b/Source/cmDocumentGeneratorExpressions.h @@ -0,0 +1,30 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2010 Kitware, Inc., Insight Software Consortium + + 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. +============================================================================*/ +#ifndef cmDocumentGeneratorExpressions_h +#define cmDocumentGeneratorExpressions_h + +#define CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS \ + "Generator expressions are evaluted during build system generation " \ + "to produce information specific to each build configuration. " \ + "Valid expressions are:\n" \ + " $ = configuration name\n" \ + " $ = main file (.exe, .so.1.2, .a)\n" \ + " $ = file used to link (.a, .lib, .so)\n" \ + " $ = file with soname (.so.3)\n" \ + "where \"tgt\" is the name of a target. " \ + "Target file expressions produce a full path, but _DIR and _NAME " \ + "versions can produce the directory and file name components:\n" \ + " $/$\n" \ + " $/$\n" \ + " $/$\n" + +#endif diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index a877680de..5dfa64ead 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -464,6 +464,25 @@ void cmDocumentVariables::DefineVariables(cmake* cm) // Variables defined by cmake, that change the behavior // of cmake + + cm->DefineProperty + ("CMAKE_POLICY_DEFAULT_CMP", cmProperty::VARIABLE, + "Default for CMake Policy CMP when it is otherwise left unset.", + "Commands cmake_minimum_required(VERSION) and cmake_policy(VERSION) " + "by default leave policies introduced after the given version unset. " + "Set CMAKE_POLICY_DEFAULT_CMP to OLD or NEW to specify the " + "default for policy CMP, where is the policy number." + "\n" + "This variable should not be set by a project in CMake code; " + "use cmake_policy(SET) instead. " + "Users running CMake may set this variable in the cache " + "(e.g. -DCMAKE_POLICY_DEFAULT_CMP=) " + "to set a policy not otherwise set by the project. " + "Set to OLD to quiet a policy warning while using old behavior " + "or to NEW to try building the project with new behavior.", + false, + "Variables That Change Behavior"); + cm->DefineProperty ("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE, "Prefixes to prepend when looking for libraries.", @@ -1336,6 +1355,29 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "this variable is defined to 1.", false,"Variables for Languages"); + cm->DefineProperty( + "CMAKE_Fortran_MODDIR_FLAG", cmProperty::VARIABLE, + "Fortran flag for module output directory.", + "This stores the flag needed to pass the value of the " + "Fortran_MODULE_DIRECTORY target property to the compiler.", + false,"Variables for Languages"); + + cm->DefineProperty( + "CMAKE_Fortran_MODDIR_DEFAULT", cmProperty::VARIABLE, + "Fortran default module output directory.", + "Most Fortran compilers write .mod files to the current working " + "directory. " + "For those that do not, this is set to \".\" and used when the " + "Fortran_MODULE_DIRECTORY target property is not set.", + false,"Variables for Languages"); + + cm->DefineProperty( + "CMAKE_Fortran_MODOUT_FLAG", cmProperty::VARIABLE, + "Fortran flag to enable module output.", + "Most Fortran compilers write .mod files out by default. " + "For others, this stores the flag needed to enable module output.", + false,"Variables for Languages"); + // variables that are used by cmake but not to be documented cm->DefineProperty("CMAKE_MATCH_0", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_MATCH_1", cmProperty::VARIABLE,0,0); diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index e6d7a6d1f..a5650d468 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -23,7 +23,7 @@ #include /* Some useful URLs: -Homepage: +Homepage: http://www.codeblocks.org File format docs: @@ -63,16 +63,6 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator() } -void cmExtraCodeBlocksGenerator::SetGlobalGenerator( - cmGlobalGenerator* generator) -{ - cmExternalMakefileProjectGenerator::SetGlobalGenerator(generator); - cmGlobalUnixMakefileGenerator3* mf = (cmGlobalUnixMakefileGenerator3*) - generator; - mf->SetToolSupportsColor(false); - mf->SetForceVerboseMakefiles(true); -} - void cmExtraCodeBlocksGenerator::Generate() { // for each sub project in the project create a codeblocks project @@ -107,7 +97,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile( /* Tree is used to create a "Virtual Folder" in CodeBlocks, in which all CMake files this project depends on will be put. This means additionally to the "Sources" and "Headers" virtual folders of CodeBlocks, there will - now also be a "CMake Files" virtual folder. + now also be a "CMake Files" virtual folder. Patch by Daniel Teske (which use C::B project files in QtCreator).*/ struct Tree @@ -115,24 +105,24 @@ struct Tree std::string path; //only one component of the path std::vector folders; std::vector files; - void InsertPath(const std::vector& splitted, - std::vector::size_type start, + void InsertPath(const std::vector& splitted, + std::vector::size_type start, const std::string& fileName); void BuildVirtualFolder(std::string& virtualFolders) const; - void BuildVirtualFolderImpl(std::string& virtualFolders, + void BuildVirtualFolderImpl(std::string& virtualFolders, const std::string& prefix) const; void BuildUnit(std::string& unitString, const std::string& fsPath) const; - void BuildUnitImpl(std::string& unitString, - const std::string& virtualFolderPath, + void BuildUnitImpl(std::string& unitString, + const std::string& virtualFolderPath, const std::string& fsPath) const; }; -void Tree::InsertPath(const std::vector& splitted, - std::vector::size_type start, +void Tree::InsertPath(const std::vector& splitted, + std::vector::size_type start, const std::string& fileName) { - if (start == splitted.size()) + if (start == splitted.size()) { files.push_back(fileName); return; @@ -301,7 +291,7 @@ void cmExtraCodeBlocksGenerator } // Now build a virtual tree string - std::string virtualFolders; + std::string virtualFolders; tree.BuildVirtualFolder(virtualFolders); // And one for std::string unitFiles; @@ -323,7 +313,7 @@ void cmExtraCodeBlocksGenerator this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str()); - // add all executable and library targets and some of the GLOBAL + // add all executable and library targets and some of the GLOBAL // and UTILITY targets for (std::vector::const_iterator lg=lgs.begin(); lg!=lgs.end(); lg++) @@ -338,9 +328,9 @@ void cmExtraCodeBlocksGenerator case cmTarget::GLOBAL_TARGET: { bool insertTarget = false; - // Only add the global targets from CMAKE_BINARY_DIR, + // Only add the global targets from CMAKE_BINARY_DIR, // not from the subdirs - if (strcmp(makefile->GetStartOutputDirectory(), + if (strcmp(makefile->GetStartOutputDirectory(), makefile->GetHomeOutputDirectory())==0) { insertTarget = true; @@ -362,7 +352,7 @@ void cmExtraCodeBlocksGenerator } if (insertTarget) { - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first.c_str(), 0, make.c_str(), makefile, compiler.c_str()); } } @@ -372,13 +362,13 @@ void cmExtraCodeBlocksGenerator // Experimental-"sub"targets as e.g. NightlyStart if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) || ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous")) - || ((ti->first.find("Experimental")==0) + || ((ti->first.find("Experimental")==0) && (ti->first!="Experimental"))) { break; } - this->AppendTarget(fout, ti->first.c_str(), 0, + this->AppendTarget(fout, ti->first.c_str(), 0, make.c_str(), makefile, compiler.c_str()); break; case cmTarget::EXECUTABLE: @@ -386,11 +376,11 @@ void cmExtraCodeBlocksGenerator case cmTarget::SHARED_LIBRARY: case cmTarget::MODULE_LIBRARY: { - this->AppendTarget(fout, ti->first.c_str(), &ti->second, + this->AppendTarget(fout, ti->first.c_str(), &ti->second, make.c_str(), makefile, compiler.c_str()); std::string fastTarget = ti->first; fastTarget += "/fast"; - this->AppendTarget(fout, fastTarget.c_str(), &ti->second, + this->AppendTarget(fout, fastTarget.c_str(), &ti->second, make.c_str(), makefile, compiler.c_str()); } break; @@ -437,7 +427,7 @@ void cmExtraCodeBlocksGenerator { for(std::vector::const_iterator ext = mf->GetSourceExtensions().begin(); - ext != mf->GetSourceExtensions().end(); + ext != mf->GetSourceExtensions().end(); ++ext) { if ((*si)->GetExtension() == *ext) @@ -467,11 +457,11 @@ void cmExtraCodeBlocksGenerator // The following loop tries to add header files matching to implementation // files to the project. It does that by iterating over all source files, - // replacing the file name extension with ".h" and checks whether such a + // replacing the file name extension with ".h" and checks whether such a // file exists. If it does, it is inserted into the map of files. // A very similar version of that code exists also in the kdevelop // project generator. - for (std::map::const_iterator + for (std::map::const_iterator sit=cFiles.begin(); sit!=cFiles.end(); ++sit) @@ -483,7 +473,7 @@ void cmExtraCodeBlocksGenerator // check if there's a matching header around for(std::vector::const_iterator ext = mf->GetHeaderExtensions().begin(); - ext != mf->GetHeaderExtensions().end(); + ext != mf->GetHeaderExtensions().end(); ++ext) { std::string hname=headerBasename; @@ -506,7 +496,7 @@ void cmExtraCodeBlocksGenerator // insert all source files in the CodeBlocks project // first the C/C++ implementation files, then all others - for (std::map::const_iterator + for (std::map::const_iterator sit=cFiles.begin(); sit!=cFiles.end(); ++sit) @@ -514,7 +504,7 @@ void cmExtraCodeBlocksGenerator fout<<" first <<"\">\n" " \n"; } - for (std::set::const_iterator + for (std::set::const_iterator sit=otherFiles.begin(); sit!=otherFiles.end(); ++sit) @@ -577,7 +567,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, "