diff options
94 files changed, 1925 insertions, 459 deletions
diff --git a/ChangeLog.manual b/ChangeLog.manual index 134b4aa..0e84fb6 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,578 @@ +Changes in CMake 2.8.12 (since 2.8.12-rc4) +------------------------------------------ +Brad King (4): + Xcode: Fix test architecture selection for Xcode >= 5 + Xcode: Teach Tests/BuildDepends to allow LINK_DEPENDS_NO_SHARED failure + Xcode: Drop XCODE_DEPEND_HELPER for Xcode >= 5 + Xcode: Fix OBJECT library support for Xcode 5 (#14254) + +Stephen Kelly (1): + Genex: Fix processing multiple include directories for relative paths + +Changes in CMake 2.8.12-rc4 (since 2.8.12-rc3) +---------------------------------------------- +Brad King (8): + VS: Future-proof Intel project format selection + MSVC: Drop /link from executable link lines with Ninja + FindCUDA: Always list custom command outputs in their targets + FindPNG: Honor old PNG_LIBRARY if provided (#14398) + FindHDF5: Fix regression in per-configuration library selection + bash-completion: Future-proof --help-*-list "cXXXX version" filtering + OS X: Search system SDKs for frameworks + Use first custom command for the same output (#14446) + +Patrick Gansterer (3): + MSVC: Fix version test for linking corelibc on Windows CE (#14420) + MSVC: Fix WinCE arch family preprocessor symbol (#14436) + VS: Use version-specific subsystem for WinCE compiler id (#14440) + +Rolf Eike Beer (1): + bootstrap: try better workaround for builds on Linux/HPPA + +Stephen Kelly (3): + Add differing target property content to policy CMP0022 warning + Fix CMP0022 warning when no old-style property is set + genex: Fix preprocessing with incomplete content (#14410). + +Changes in CMake 2.8.12-rc3 (since 2.8.12-rc2) +---------------------------------------------- +Robert Maynard (1): + cmMakefile: Do not track CMake temporary files. + +Changes in CMake 2.8.12-rc2 (since 2.8.12-rc1) +---------------------------------------------- +Brad King (2): + Fix RunCMake.Configure test expectation newline matching + Clean up install rules of CMake itself (#14371) + +Clinton Stimpson (1): + OSX: Allow an empty INSTALL_NAME_DIR to override MACOSX_RPATH. + +Eric BĂ©langer (1): + FindImageMagick: Find libraries named with HDRI support (#14348) + +Raphael Kubo da Costa (1): + FindTCL: Add BSD paths for Tcl/Tk 8.6 + +Robert Maynard (2): + VS: Generate ToolsVersion matching each VS version + cmMakefile: Do not track configured files known to be temporary + +Rolf Eike Beer (1): + CheckC*CompilerFlag: add documentation what to expect from a positive result + +Stephen Kelly (6): + Fix OLD behavior of CMP0021. + try_compile: Extract IMPORTED targets from LINK_DEPENDENT_LIBRARIES + try_compile: Extract IMPORTED targets from INTERFACE_LINK_LIBRARIES + Genex: Fix evaluation of MAP_IMPORTED_CONFIG_<CONFIG> + Fix some whitespace errors in docs. + Normalize system directories from the interface target property + +Yury G. Kudryashov (1): + CPack: Fix a typo in documentation + +Zack Galbreath (1): + CTest: Fix GTM coverage parsing line offset bug + +Changes in CMake 2.8.12-rc1 (since 2.8.11.2) +-------------------------------------------- +Adam J. Weigold (1): + CPackWIX: Add support for custom WiX templates + +Alex Neundorf (12): + CMakeSystem: include toolchain file after setting CMAKE_HOST_ (#13796) + Add support files for C, C++ and ASM for the IAR toolchain. + Add regexps for the IAR toolchain to the vendor list. + Add IAR to the CMakeDetectC(XX)CompilerID.c(pp).in + cmake-gui: use shortcut F only for "Find in Output" + Eclipse: fix #14204 and #14205: no file links to directories + automoc: add a global AUTOMOC_TARGETS_FOLDER property + install: do not strip dll import libraries (#14123) + ExportTargets: add one more comment to the generated file. + Add documentation for the --graphviz support + graphvizoptions: add copyright notice + add macros cmake_print_properties() and cmake_print_variables() + +Alexander Mohr (1): + VS: Detect MSVC compiler id on ARM toolchain + +Andreas Mohr (10): + Fix spelling and typos (affecting users) + Fix spelling and typos (affecting binary data / module messages) + Fix spelling and typos (non-binary) + Fix spelling and typos (product names) + FindwxWidgets: add DOC strings with usual style + Explain distribution of Win9x binary on all Windows versions. + VS10: add detailed comment about MIDL processing + Docs: Update description of CMAKE_(BUILD_TYPE|CONFIGURATION_TYPES) + Docs: Clarify that CMAKE_*_(PREFIX|SUFFIX) affect filenames + Docs: Clarify wording "flag used" => "flag (to|will) be used" + +Ben Boeckel (12): + set_property: Do not remove a property when APPENDing nothing + Tests/RunCMake: Document stripping of expected output + export: Error when exporting a target without a language + variable_watch: Store client data as pointers + variable_watch: Add a deleter for the client data + variable_watch: Match client_data when finding duplicates + variable_watch: Allow specifying the data to match in RemoveWatch + variable_watch: Prevent making extra entries in the watch map + variable_watch: Fix a typo in the error message + variable_watch: Don't share memory for callbacks + variable_watch: Check newValue for NULL + variable_watch: Add test for watching a variable multiple times + +Bill Hoffman (1): + Do not set CMAKE_MATCH_ variables when not neeeded + +Bjoern Thiel (1): + SelectLibraryConfigurations: Fix for cached <base>_LIBRARY + +Brad King (91): + VS: Separate compiler and linker PDB files (#11899, #14062) + MSVC: Invoke 'link' directly for executables + Ninja: Fix OBJECT_DIR placeholder path conversion + VS 10: Escape ; as %3B in preprocessor definitions (#14073) + CTest: Simplify ctest_* command source/build dir lookup + get_filename_component: Add explicit unit tests + get_filename_component: Add DIRECTORY option (#14091) + Xcode: Use explicitFileType to mark source types (#14093) + Check{C,CXX}CompilerFlag: Test using C locale (#14102) + Windows: Search '/' prefix only when cross compiling (#10994) + Recognize ld with toolchain prefix (#13960) + VS: Always initialize CMAKE_CONFIGURATION_TYPES in IDE generators + Begin post-2.8.11 development + Sanitize linker name to parse implicit link line (#14154) + VS: Allow /Fa to set AssemblerListingLocation (#14153) + Tests/IncludeDirectories: Avoid shared library with no symbols + if: Add test for IS_DIRECTORY + try_compile: Add test for bad call error cases + try_compile: Refactor argument processing + variable_watch: Add test for MODIFIED_ACCESS report + bootstrap: Compile KWSys SystemTools with UTIME(S|NSAT) values + variable_watch: Remove leftover debugging code (#14187) + variable_watch: Print accesses as "CMake Debug Log" messages + Docs: Clarify CMAKE_PARENT_LIST_FILE (#14194) + get_filename_component: Test ABSOLUTE of .. after root component + try_compile: Add signature to allow multiple SOURCES + enable_language: Clarify documentation + Split cmBootstrapCommands.cxx into two sources + Document CMAKE_INSTALL_PREFIX in CMAKE_SYSTEM_PREFIX_PATH + cmake: Document "-E tar" support for .zip (#14225) + FindBoost: Clarify failure on missing 'static' libs (#14235) + CMakeDetermineVSServicePack: Improve documentation + CMakeDetermineVSServicePack: Add VS 11 update 1 and 2 (#14239) + Document ENV syntax as a "variable" (#14245) + Embarcadero: Use response files only for includes, objects, and libs + Escape target flags taken from COMPILE_OPTIONS + Refactor target COMPILE_OPTIONS and COMPILE_FLAGS handling + CMakeDetermineVSServicePack: Add VS 11 update 3 + Document removal of 'register' from flex/bison output + VS12: Find proper MSBuild for VSProjectInSubdir test + Fortran: Use explicit type in Fortran 90 check + project: Document top-level CMakeLists.txt requirement + ExternalProject: Document multiple COMMAND lines + include: Clarify variable access scope for included file + VS: Fix /MAP:mapfile flag mapping (#14282) + cmake: On configure error suggest looking at CMake*.log files + try_compile: Escape CMAKE_<lang>_FLAGS in test projects (#14268) + try_compile: Add COPY_FILE_ERROR option to capture failure + FindPNG: Add versioned library names for 1.6 (#14289) + cmake: Fix resource leak reported by cppcheck + VS,Xcode: Drop incorrect legacy dependency trace (#14291) + OS X: Add copyright notices to Darwin-*-Fortran.cmake + VS: Avoid leaking child process output back to IDE (#14266) + Fix ExportImport test cmp0022NEW build on Watcom + add_test: Document test name restrictions (#14298) + UseJava: Update notice of copyright by Kitware + add_custom_command: Manage backtrace memory correctly (#14299) + Teach compiler ABI check to tolerate try_compile COPY_FILE failure + Test COMPILE_DEFINITIONS target property get/set/get round-trip + Check*CompilerFlag: Document use of CMAKE_REQUIRED_DEFINITIONS (#14309) + sha2: Avoid type-punned pointer dereference (#14314) + VS 6: Tell BuildDepends test to tolerate ninjadep failure + cmMakefile: Do not track configured files known to be temporary + libarchive: Update README-CMake.txt for new snapshot + libarchive: Include cm_zlib.h to get zlib used by CMake + libarchive: Silence API deprecation warnings + libarchive: Avoid struct init with variable + libarchive: Remove build options not used by CMake + libarchive: Backport to CMake 2.8.2 + VS10: Honor user-specified /SUBSYSTEM: flag (#14326) + VS10: Escape include paths in XML project files (#14331) + OS X: Search for SDK based on deployment target (#14324) + bootstrap: Do not suppress CMAKE_OSX_SYSROOT if CFLAGS have -isysroot (#14324) + OS X: Enable command-line build without tools in PATH + VS 6,7: Refactor local generators to avoid GetSourceFileWithOutput + cmake-gui: Fix build rules for Qt5 on Windows + Include cmMakefile.h before cm*Lexer.h to get stdint.h first + Skip CTestLimitDashJ test on Borland + Add RunCMake.Syntax test to cover argument parsing + cmListFileLexer: Fix line number after backslash in string + cmListFileLexer: Split normal and legacy unquoted arguments + cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum + Add RunCMake.Syntax test cases for command invocation styles + cmListFileCache: Convert CMake language parser to class + Warn about arguments not separated by whitespace + Warn about unquoted arguments that look like long brackets + cmListFileLexer: Modify flex output to avoid Borland warning + Cygwin: Avoid legacy warnings in RunCMake.* tests + Update version introducing CMP0021, CMP0022, and CMP0023 + OS X: Do not default to non-existent deployment target SDK + Do not warn about left paren not separated by a space + +Christian Maaser (1): + VS: Add support for .NET target framework version + +Clinton Stimpson (12): + Improve documentation for CPACK_PACKAGE_INSTALL_REGISTRY_KEY. + Refactor how bundles and frameworks are supported. + Xcode: Add support for shared library versioning + OS X: Fix getting of CFBundle LOCATION property. + OS X: Add RPATH support for Mac. + Xcode: Add rpath support in Xcode generator. + OS X: Add support for @rpath in export files. + OS X: Add test for rpaths on Mac. + OS X: Improvements for getting install name of dylib. + OS X: Enable rpath support on Mac OS X when find_library() is used. + OS X: Fix regression handling frameworks for Ninja + OS X: If necessary, use xcrun to help find otool used to query install names. + +CĂ©dric OCHS (1): + Xcode: Support XCODE_ATTRIBUTE_ with [variant=<config>] (#12532) + +Daniele E. Domenichelli (15): + FindGTK2: Move check for pangocairo in gtk module + FindGTK2: Detect gthread library + FindFreetype: Detect Freetype installed by GtkMM installer for win + FindGTK2: Do not fail on MSVC11 if vc100 libraries are available + FindGTK2: Add GTK2_DEFINITIONS variable + SelectLibraryConfigurations: Do not cache the _LIBRARY variable + SelectLibraryConfigurations: Use -NOTFOUND instead of copying the vars + FindGTK2: Use GTK_XXX_LIBRARY_DEBUG libraries in debug mode + FindGTK2: Append _LIBRARY to var name in _GTK2_FIND_LIBRARY + FindGTK2: Append _INCLUDE_DIR to var name in _GTK2_FIND_INCLUDE_DIR + FindGTK2: Update local changelog + FindGTK2: Remove GTK2_SKIP_MARK_AS_ADVANCED option + FindGTK2: gthread-2.0 folder does not exist + FindGTK2: Detect gmodule library + FindGTK2: Detect pangoft2 and pangoxft libraries + +David Coppa (1): + OpenBSD: Enable ELF parsing and editing (#14241) + +David Golub (1): + CPack/NSIS: Obtain path from which to uninstall from registry (#14124) + +Eric NOULARD (5): + Add support for componentized USER spec file + CPackRPM add mechanism to remove path from generated list of file in RPM spec. + CPackRPM add /usr/lib64 to the list of builtin to-be-excluded path + CPackRPM protect '@' character in filename processed in the spec file. + CPackRPM make the changelog line conform to expected format + +Fredrik Axelsson (1): + CPackWIX: Handle CPACK_PACKAGE_EXECUTABLES (#13967) + +Funda Wang (1): + FindImageMagick: Find v6 include dir (#14174) + +Graham Markall (2): + OS X: Add Fortran library version flags (#14249) + UseJava: Pass sources to javac using response file (#13028) + +Gregoire Lejeune (1): + Allow using Java in a cross-compilation toolchain + +Ian Monroe (2): + Ninja: use cd /D to set directory on Windows + CPackWIX: Fix MSI package layout regression from parent + +Igor Murzov (2): + bash-completion: Add -S,-SP options arguments completion + bash-completion: Fix/improve generator names extraction + +Jack O'Connor (1): + Eclipse: Add a missing space in the documentation + +Jason Spiro (1): + MinGW: Find mingw32-make included with Code::Blocks IDE (#14302) + +John Farrier (2): + VS: Add Windows Forms Support + VS: Add VS_GLOBAL_ROOTNAMESPACE target property + +Jonas Andersen (1): + VS: Add Resx configuration to the vcxproj file + +LibArchive Upstream (1): + libarchive 3.1.2 (reduced) + +Marc Bartholomaeus (4): + cmake-gui: Add search functions for Output window (#9733) + cmake-gui: Add search functions to the context menu of the Output widget + cmake-gui: Change shortcut of the search field from Ctrl-F to Alt-E + cmake-gui: Add function for going to next error message in Output window + +Marcel Loose (1): + FindCUDA: Remove duplicate entries from INCLUDE_DIRECTORIES. + +Marius Schamschula (1): + FindX11: Search in /opt/X11 for OS X 10.8 (#14232) + +Mathias Gaunard (1): + FindCUDA: CUDA_COMPUTE_BUILD_PATH uses relative paths to binary dir. + +Matt McCormick (1): + ExternalProject: Allow blank SVN_USERNAME/SVN_PASSWORD (#14128) + +Matthew Bentham (1): + Xcode: Honor CMAKE_(MODULE|SHARED)_LINKER_FLAGS_<CONFIG> (#14161) + +Matthew Woehlke (3): + UseJava.cmake: fully use cmake_parse_arguments in add_jar + FindProtobuf: also find pthread + UseJava.cmake: document add_jar compat shim + +Nicolas Despres (1): + Optimize custom command full-path dependency lookup + +Nils Gladitz (1): + Add cmake_host_system_information command + +Patrick Gansterer (20): + Add option to use stdout/stderr of original terminal in cmake --build + Unify the way the flags of a static library are read + Add support for CMAKE_STATIC_LINKER_FLAGS + Add CMAKE_STATIC_LINKER_FLAGS to CMakeCommonLanguageInclude + Add documentation for the missing CMAKE_*_LINKER_FLAGS_* variables + Add additonal tests for the linker flags + VS6: Add handling of CMAKE_*_LINKER_FLAGS_<CONFIG> variables + VS6: Hardcode id_machine_6 for compiler detection + VS10: Do not set the TargetMachine when detecting the compiler + VS: Set CMAKE_VS_PLATFORM_NAME for VS7 and VS71 too + VS: Replace ArchitectureId with PlatformName + VS12: Remove duplicated overload of UseFolderProperty() + Fix detection of WinCE SDKs with 64bit verion of CMake + VS: Unify how the name of the generator is specified + VS10: Add support for assembler code (#11536) + WIN: Use COFF file header header for architecture detection (#14083) + Improve const-correctness in cmVisualStudioGeneratorOptions + Fix setting of the entry point symbol for Windows CE (#14088) + Add support for new Windows CE compiler + VS11: Add support for Windows CE SDKs + +Paul Kunysch (1): + CTest: Add test for running many tests in parallel + +Pavel Shramov (1): + cmDependsC: Collapse relative include paths + +Petr Kmoch (5): + Add projectDir parameter to GenerateBuildCommand + VS: Create parser for Visual Studio .sln files + VS: Use .sln parser to build targets in subdirs with msbuild (#13623) + VS: Add test for building MSBuild project in subdir + ctest_build: Pass projectDir to GenerateBuildCommand + +Reid Kleckner (1): + Ninja: Make cmcldeps depfile output more consistent with 'ninja -t msvc' + +Richard Ulrich (3): + CPackWIX: Handle multiple shortcuts in the start menu + CPackWIX: Add option to specify the language(s) of the installer + CMakeCPack: Provide an upgrade guid for WiX + +Robert Maynard (9): + cmMakefile: Refactor AddCMakeDependFile and AddCMakeOutputFile. + Ninja: Track configured files so we can regenerate them. + cmMakefile: Track configured files so we can regenerate them (#13582) + Add a test to expose a bug with add_custom_command and ninja. + Ninja: GlobalNinjaGenerator WriteBuild and WritePhonyBuild non static + Ninja: Custom Command file depends don't need to exist before building + FindCUDA: Search for libraries in <prefix>/lib/<arch>/nvidida-current. + Ninja: Properly convert all paths to unix style before we do set intersection. + Ninja: Update BuildDepends test to verify cmcldeps depfiles. + +Robin Lee (1): + FindOpenSSL: Fix spelling of CMAKE_CROSSCOMPILING (#14075) + +Rolf Eike Beer (25): + FindOpenGL: simplify OS selection code + FindOpenGL: require headers to be found on non-Windows platforms (#13746) + Tests: create output files for all memory checkers + CTest: use an output file for Valgrind (#14110) + CTest: remove unreachable code and CTestTestMemcheckUnknown test + Tests: remove code duplication in CTestTestMemCheck tests + Tests: verify that memory checker output files are always present + CTest: drop suppression for gcc 2.9.6 errors from default Valgrind flags + Tests: add test for non-existent Valgrind suppression file + CTest: fix comment documenting cmBoundsCheckerParser class + Tests: add a test with custom options passed to valgrind + CTest: make sure never to report negative test times (#14132) + Doc: fix example for FAIL_REGULAR_EXPRESSION + CTest: break after first regex match on output + Tests: ignore Guard Malloc messages in MemChecker tests + CTest: avoid useless changing of directory + Tests: fix build of dummy memtester on AIX + wizard: fix warnings + wizard: simplify control flow + cmTarget: drop the unused local typedef LinkLine + Tests: ignore GuardMalloc messages on all Apple build, not just XCode ones + replace string(... MATCHES "^const$) with string(... STREQUAL "const") + Revert "CTest: fix pre and post test commands with spaces" (#13887) + FindPNG: improve library detection (#14301) + CTest: create one output file per memcheck (#14303) + +Sean McBride (1): + Remove some uses of obsolete 'register' storage specifier + +Sebastian Leske (1): + Document CMAKE_<LANG>_FLAGS variable (#14305) + +Stephen Kelly (126): + Make the QtAutomoc test compile with either Qt 4 or Qt 5 + Add a test for Qt5Automoc + Remove an endif() followed by an if() for the same condition. + Fix some copyastos in the DetermineRCCompiler file. + Test transitive includes from setting the LINK_LIBRARIES property. + Test the use of target transitive compile definitions with moc. + Fix handling of commas in arbitrary content in genexes. + Fix style. + Remove unused marker for a variable which is now used. + Extract the ProcessArbitraryContent method. + Rename the method determining if a genex accepts arbitrary content. + Make it possible for any genex to have arbitrary content at the end. + Add the JOIN generator expression. + Test that linking using the debug keyword to tll works. + automoc: Read target defines unconditionally + Remove unused typedef. + Fix brace indentation. + Add EXPORT_NAME property. + Remove unused vector population. + Sublime: Honor source-level COMPILE_FLAGS property + Docs: cmake -G selects a "build system" generator + Recognize shared library files with a numerical suffix + FindQt4: Fix QUIET failure with Qt 5 but not Qt 4 + Error on relative path in INCLUDE_DIRECTORIES target property. + include_directories: Fix handling of empty or space-only entries + CTest: Read CTEST_PARALLEL_LEVEL from environment + string: Add MAKE_C_IDENTIFIER subcommand + GenerateExportHeader: Add newlines to separate the compiler output. + GenerateExportHeader: Allow use of of this macro with MODULEs. + file: Add GENERATE command to produce files at generate time + Tests/Module/GenerateExportHeader: Test exported free-function + Add $<LINK_LANGUAGE> generator expression + GenerateExportHeader: Generate only C identifiers as defines + Tests/CompileDefinitions: Avoid spaces in defines on VS 6 + Use the qt5::moc imported target instead of a variable. + QtAutomoc: Get the Qt version through the target link interface + Fix indentation. + VS6: Rename some variables to correspond to config values. + Add cmLocalGenerator::GetCompileOptions. + Add <LANG>_COMPILER_ID generator expressions. + cmTarget: Rename struct to be more re-usable. + cmTarget: Rename LinkInterfaceIncludeDirectoriesEntries + Add COMPILE_OPTIONS target property. + Add target_compile_options command. + Introduce target property <LANG>_VISIBILITY_PRESET + Add a COMPILE_OPTION for a VISIBILITY_INLINES_HIDDEN target property. + Qt4Macros: Allow specifying a TARGET in invokations of macros. + Introduce add_compile_options command. + Remove unused cmAddDefinitionsCommand::ParseDefinition method. + Add some spaces to the INCLUDE_DIRECTORIES documentation. + CLI: Suppress the unused warning if the key value pair is cached. + Use --sysroot when cross compiling. + Add missing 'seen' check for evaluating COMPILE_OPTIONS. + Find targets in INTERFACE_COMPILE_OPTIONS when exporting for try_compile. + Use a preprocessor loop to manage the valid transitive properties. + Generate INTERFACE_COMPILE_OPTIONS on export. + Genex: Fix indentation in docs. + cmSystemTools: Fix typo in comment. + Style: Don't put an else after a return. + Add compiler target compile options. + QtAutomoc: Fix handling of list separator for compile definitions. + QtAutomoc: Use config-dependent compile definitions and includes. + De-duplicate version comparison code. + Add generator expressions for version comparision. + Don't run the WarnUnusedCliUnused test on Windows. + Add whitespace after colons in error messages. + Add missing return after error report. + Genex: Make LINK_LANGUAGE report an error when evaluating link libraries. + Genex: Extend EvaluatingLinkLibraries to also check the top target name. + Genex: Report error if a target file is needed to evaluate link libraries. + Add generator expressions for compiler versions. + Split the GeneratorExpression test into a third part. + Remove unused variable. + Add Target API to determine if an include is a system include. + Store system include directories in the cmTarget. + Extend the cmTargetPropCommandBase interface property handling. + Add a SYSTEM parameter to target_include_directories (#14180) + Add entire link interface transitive closure as target depends. + Test non-IMPORTED libraries in the INTERFACE of IMPORTED libraries. + GenexEval: Add abstracted access to link interface for a target. + Introduce the LINK_ONLY generator expression. + Introduce the INTERFACE_LINK_LIBRARIES property. + Export: Generate INTERFACE_LINK_LIBRARIES property on targets. + TLL: Don't populate old link interface if CMP0022 is NEW. + Overload cmLocalGenerator::AppendDefines to add a list. + Add an overload of cmIDEOptions::AddDefines taking a vector of strings. + Refactor cmTarget::GetCompileDefinitions to use an out-vector, not a string. + Document some variables for deprecation control. + Genex: Make CMP0021 and CMP0022 usable with TARGET_POLICY + Revert "Use --sysroot when cross compiling." + Add target property debugging for COMPILE_DEFINITIONS + Mark qt4_use_modules and qt4_automoc as obsolete. + Add the INTERFACE_SYSTEM_INCLUDE_DIRECTORIES target property. + Don't add trailing whitespace to error message. + Remove TODO to uniq COMPILE_OPTIONS + Remove the LINK_LANGUAGE generator expression. + Genex: Fix $<CONFIG> with IMPORTED targets and multiple locations. + FindQt4: Don't use Qt component _FOUND vars before they're defined (#14286) + Add a convenient way to add the includes install dir to the INTERFACE. + Use linked frameworks as a source of include directories. + target_link_libraries: Add PUBLIC/PRIVATE/INTERFACE keyword signature + FindQt4: Re-add QAxServer to the QT_MODULES. + FindQt4: Populate the INTERFACE_LINK_LIBRARIES of IMPORTED targets. + Genex: Allow relative paths in INSTALL_INTERFACE. + cmTarget: Fix property name typo in docs. + Docs: Document file(GENERATE) CONDITION as optional. + Qt4Macros: Remove unneeded generate CONDITION. + Qt4Macros: Remove undefined varible use. + Qt4Macros: Simplify some variable population. + Docs: Document existing target property debugging options. + Docs: Trim trailing whitespace in generated doc. + Docs: Generalize and de-duplicate VISIBILITY_PREFIX docs. + Docs: Document variables for default visibility values. + Export: Fix typo of LINK_INTERFACE_LIBRARIES. + cmTarget: Remove duplicates when printing traces of tll signatures + cmTarget: Fix iface libraries and languages for static libraries. + Genex: Disallow LINKER_LANGUAGE only when used on a static library. + install: Remove error condition using INCLUDES DESTINATION without EXPORT. + Fix crash on export of target with empty INTERFACE_INCLUDE_DIRECTORIES. + Allow target commands to be invoked with no items (#14325). + Docs: Fix typo in CMAKE_DEBUG_TARGET_PROPERTIES + cmTarget: Add NAME property + Export: Process generator expressions from INCLUDES DESTINATION. + Add the ALIAS target concept for libraries and executables. + Revert "Add compiler target compile options." + Genex: Fix segfault when parsing ends with parameter expectation. + +Vadim Zhukov (1): + Add cmake_reset_check_state() macro + +Victor Zverovich (1): + Use GmakeErrorParser instead of deprecated MakeErrorParser (fixes bug 0013699) + +Yichao Yu (1): + variable_watch: Add missing string enumeration entry (#14188) + +Ă–mer Fadıl USTA (3): + ccmake: Add missing initializers reported by cppcheck + libarchive: Fix free() order to avoid accessing freed memory + cmcurl: Fix resource leak reported by cppcheck + Changes in CMake 2.8.11.2 (since 2.8.11.1) ------------------------------------------ Alex Neundorf (1): diff --git a/Docs/bash-completion/cmake b/Docs/bash-completion/cmake index 5f33c09..59e0298 100644 --- a/Docs/bash-completion/cmake +++ b/Docs/bash-completion/cmake @@ -111,12 +111,12 @@ _cmake() ;; --help-command) COMPREPLY=( $( compgen -W '$( cmake --help-command-list 2>/dev/null| - tail -n +2 )' -- "$cur" ) ) + grep -v "^cmake version " )' -- "$cur" ) ) return ;; --help-module) COMPREPLY=( $( compgen -W '$( cmake --help-module-list 2>/dev/null| - tail -n +2 )' -- "$cur" ) ) + grep -v "^cmake version " )' -- "$cur" ) ) return ;; --help-policy) @@ -126,12 +126,12 @@ _cmake() ;; --help-property) COMPREPLY=( $( compgen -W '$( cmake --help-property-list \ - 2>/dev/null | tail -n +2 )' -- "$cur" ) ) + 2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) ) return ;; --help-variable) COMPREPLY=( $( compgen -W '$( cmake --help-variable-list \ - 2>/dev/null | tail -n +2 )' -- "$cur" ) ) + 2>/dev/null | grep -v "^cmake version " )' -- "$cur" ) ) return ;; esac diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack index 51638c5..9ab6048 100644 --- a/Docs/bash-completion/cpack +++ b/Docs/bash-completion/cpack @@ -20,7 +20,7 @@ _cpack() -D) [[ $cur == *=* ]] && return # no completion for values COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \ - 2>/dev/null | tail -n +2 )' -S = -- "$cur" ) ) + 2>/dev/null | grep -v "^cpack version " )' -S = -- "$cur" ) ) compopt -o nospace return ;; @@ -38,12 +38,12 @@ _cpack() ;; --help-command) COMPREPLY=( $( compgen -W '$( cpack --help-command-list 2>/dev/null| - tail -n +2 )' -- "$cur" ) ) + grep -v "^cpack version " )' -- "$cur" ) ) return ;; --help-variable) COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \ - 2>/dev/null | tail -n +2 )' -- "$cur" ) ) + 2>/dev/null | grep -v "^cpack version " )' -- "$cur" ) ) return ;; esac diff --git a/Docs/bash-completion/ctest b/Docs/bash-completion/ctest index 7433d3d..25cb998 100644 --- a/Docs/bash-completion/ctest +++ b/Docs/bash-completion/ctest @@ -63,7 +63,7 @@ _ctest() ;; --help-command) COMPREPLY=( $( compgen -W '$( ctest --help-command-list 2>/dev/null| - tail -n +2 )' -- "$cur" ) ) + grep -v "^ctest version " )' -- "$cur" ) ) return ;; esac diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index ebd9ce0..da955cb 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -133,7 +133,11 @@ Id flags: ${testflags} endif() if(CMAKE_VS_WINCE_VERSION) set(id_entrypoint "mainACRTStartup") - set(id_subsystem 9) + if("${vs_version}" VERSION_LESS 9) + set(id_subsystem 9) + else() + set(id_subsystem 8) + endif() else() set(id_subsystem 1) endif() @@ -157,7 +161,8 @@ Id flags: ${testflags} ) # Match the compiler location line printed out. if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") - set(_comp "${CMAKE_MATCH_1}") + # Strip VS diagnostic output from the end of the line. + string(REGEX REPLACE " \\(TaskId:[0-9]*\\)$" "" _comp "${CMAKE_MATCH_1}") if(EXISTS "${_comp}") file(TO_CMAKE_PATH "${_comp}" _comp) set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index ae17454..b67e0f0 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -19,18 +19,6 @@ find_program(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable" function(_FIND_ECLIPSE_VERSION) # This code is in a function so the variables used here have only local scope - if(CMAKE_ECLIPSE_EXECUTABLE) - # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036) - get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) - get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) - file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") - if(APPLE AND NOT _ECLIPSE_FEATURE_DIR) - file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*") - endif() - if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") - set(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) - endif() - endif() # Set up a map with the names of the Eclipse releases: set(_ECLIPSE_VERSION_NAME_ "Unknown" ) @@ -41,15 +29,34 @@ function(_FIND_ECLIPSE_VERSION) set(_ECLIPSE_VERSION_NAME_3.6 "Helios" ) set(_ECLIPSE_VERSION_NAME_3.7 "Indigo" ) set(_ECLIPSE_VERSION_NAME_4.2 "Juno" ) + set(_ECLIPSE_VERSION_NAME_4.3 "Kepler" ) + + if(NOT DEFINED CMAKE_ECLIPSE_VERSION) + if(CMAKE_ECLIPSE_EXECUTABLE) + # use REALPATH to resolve symlinks (http://public.kitware.com/Bug/view.php?id=13036) + get_filename_component(_REALPATH_CMAKE_ECLIPSE_EXECUTABLE "${CMAKE_ECLIPSE_EXECUTABLE}" REALPATH) + get_filename_component(_ECLIPSE_DIR "${_REALPATH_CMAKE_ECLIPSE_EXECUTABLE}" PATH) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/features/org.eclipse.platform*") + if(APPLE AND NOT _ECLIPSE_FEATURE_DIR) + file(GLOB _ECLIPSE_FEATURE_DIR "${_ECLIPSE_DIR}/../../../features/org.eclipse.platform*") + endif() + if("${_ECLIPSE_FEATURE_DIR}" MATCHES ".+org.eclipse.platform_([0-9]+\\.[0-9]+).+") + set(_ECLIPSE_VERSION ${CMAKE_MATCH_1}) + endif() + endif() + + if(_ECLIPSE_VERSION) + message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") + else() + set(_ECLIPSE_VERSION "3.6" ) + message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") + endif() - if(_ECLIPSE_VERSION) - message(STATUS "Found Eclipse version ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})") + set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") else() - set(_ECLIPSE_VERSION "3.6" ) - message(STATUS "Could not determine Eclipse version, assuming at least ${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}}). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") + message(STATUS "Eclipse version is set to ${CMAKE_ECLIPSE_VERSION}. Adjust CMAKE_ECLIPSE_VERSION if this is wrong.") endif() - set(CMAKE_ECLIPSE_VERSION "${_ECLIPSE_VERSION} (${_ECLIPSE_VERSION_NAME_${_ECLIPSE_VERSION}})" CACHE STRING "The version of Eclipse. If Eclipse has not been found, 3.6 (Helios) is assumed.") set_property(CACHE CMAKE_ECLIPSE_VERSION PROPERTY STRINGS "3.2 (${_ECLIPSE_VERSION_NAME_3.2})" "3.3 (${_ECLIPSE_VERSION_NAME_3.3})" "3.4 (${_ECLIPSE_VERSION_NAME_3.4})" @@ -57,16 +64,17 @@ function(_FIND_ECLIPSE_VERSION) "3.6 (${_ECLIPSE_VERSION_NAME_3.6})" "3.7 (${_ECLIPSE_VERSION_NAME_3.7})" "4.2 (${_ECLIPSE_VERSION_NAME_4.2})" + "4.3 (${_ECLIPSE_VERSION_NAME_4.3})" ) endfunction() -_FIND_ECLIPSE_VERSION() +_find_eclipse_version() # Try to find out how many CPUs we have and set the -j argument for make accordingly set(_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS "") include(ProcessorCount) -PROCESSORCOUNT(_CMAKE_ECLIPSE_PROCESSOR_COUNT) +processorcount(_CMAKE_ECLIPSE_PROCESSOR_COUNT) # Only set -j if we are under UNIX and if the make-tool used actually has "make" in the name # (we may also get here in the future e.g. for ninja) diff --git a/Modules/CMakeGraphVizOptions.cmake b/Modules/CMakeGraphVizOptions.cmake index e4af54c..2f04abb 100644 --- a/Modules/CMakeGraphVizOptions.cmake +++ b/Modules/CMakeGraphVizOptions.cmake @@ -53,7 +53,7 @@ # Default : TRUE ##end ##variable -# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude static libraries from the generated graphs. +# GRAPHVIZ_MODULE_LIBS - Set this to FALSE to exclude module libraries from the generated graphs. # Mandatory : NO # Default : TRUE ##end diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index d042d5e..3c56b7f 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -3,7 +3,8 @@ # CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path> # [PATH_VARS <var1> <var2> ... <varN>] # [NO_SET_AND_CHECK_MACRO] -# [NO_CHECK_REQUIRED_COMPONENTS_MACRO]) +# [NO_CHECK_REQUIRED_COMPONENTS_MACRO] +# [NO_FIND_DEPENDENCY_MACRO]) # # CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain # configure_file() command when creating the <Name>Config.cmake or <Name>-config.cmake @@ -154,7 +155,7 @@ endmacro() function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile) - set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO) + set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO NO_FIND_DEPENDENCY_MACRO) set(oneValueArgs INSTALL_DESTINATION ) set(multiValueArgs PATH_VARS ) @@ -240,6 +241,40 @@ endmacro() ") endif() + if(NOT CCF_NO_FIND_DEPENDENCY_MACRO) + set(PACKAGE_INIT "${PACKAGE_INIT} +macro(find_dependency dep) + if (NOT \${dep}_FOUND) + if (\${ARGV1}) + set(version \${ARGV1}) + endif() + set(exact_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT) + set(exact_arg EXACT) + endif() + set(quiet_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(quiet_arg QUIET) + endif() + set(required_arg) + if(\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(required_arg REQUIRED) + endif() + + find_package(\${dep} \${version} \${exact_arg} \${quiet_arg} \${required_arg}) + if (NOT \${dep}_FOUND) + set(\${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE \"\${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency \${dep} could not be found.\") + set(\${CMAKE_FIND_PACKAGE_NAME}_FOUND False) + return() + endif() + set(required_arg) + set(quiet_arg) + set(exact_arg) + endif() +endmacro() +") + endif() + set(PACKAGE_INIT "${PACKAGE_INIT} ####################################################################################") diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 8514164..0c246a1 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -289,27 +289,13 @@ if( NOT HDF5_FOUND ) ENV HDF5_ROOT PATH_SUFFIXES lib Lib ) select_library_configurations( HDF5_${LIB} ) - # even though we adjusted the individual library names in - # select_library_configurations, we still need to distinguish - # between debug and release variants because HDF5_LIBRARIES will - # need to specify different lists for debug and optimized builds. - # We can't just use the HDF5_${LIB}_LIBRARY variable (which was set - # up by the selection macro above) because it may specify debug and - # optimized variants for a particular library, but a list of - # libraries is allowed to specify debug and optimized only once. - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_DEBUG - ${HDF5_${LIB}_LIBRARY_DEBUG} ) - list( APPEND HDF5_${LANGUAGE}_LIBRARIES_RELEASE - ${HDF5_${LIB}_LIBRARY_RELEASE} ) + list(APPEND HDF5_${LANGUAGE}_LIBRARIES ${HDF5_${LIB}_LIBRARY}) endforeach() list( APPEND HDF5_LIBRARY_DIRS ${HDF5_${LANGUAGE}_LIBRARY_DIRS} ) # Append the libraries for this language binding to the list of all # required libraries. - list( APPEND HDF5_LIBRARIES_DEBUG - ${HDF5_${LANGUAGE}_LIBRARIES_DEBUG} ) - list( APPEND HDF5_LIBRARIES_RELEASE - ${HDF5_${LANGUAGE}_LIBRARIES_RELEASE} ) + list(APPEND HDF5_LIBRARIES ${HDF5_${LANGUAGE}_LIBRARIES}) endforeach() # We may have picked up some duplicates in various lists during the above @@ -329,30 +315,10 @@ if( NOT HDF5_FOUND ) if( HDF5_INCLUDE_DIRS ) _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS ) endif() - if( HDF5_LIBRARIES_DEBUG ) - _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG ) - endif() - if( HDF5_LIBRARIES_RELEASE ) - _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE ) - endif() if( HDF5_LIBRARY_DIRS ) _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS ) endif() - # Construct the complete list of HDF5 libraries with debug and optimized - # variants when the generator supports them. - if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( HDF5_LIBRARIES ) - foreach( _lib ${HDF5_LIBRARIES_DEBUG} ) - list( APPEND HDF5_LIBRARIES debug ${_lib} ) - endforeach() - foreach( _lib ${HDF5_LIBRARIES_RELEASE} ) - list( APPEND HDF5_LIBRARIES optimized ${_lib} ) - endforeach() - else() - set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} ) - endif() - # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support set( HDF5_IS_PARALLEL FALSE ) diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake new file mode 100644 index 0000000..31fe54c --- /dev/null +++ b/Modules/FindLua.cmake @@ -0,0 +1,153 @@ +# Locate Lua library +# This module defines +# LUA_FOUND - if false, do not try to link to Lua +# LUA_LIBRARIES - both lua and lualib +# LUA_INCLUDE_DIR - where to find lua.h +# LUA_VERSION_STRING - the version of Lua found +# LUA_VERSION_MAJOR - the major version of Lua +# LUA_VERSION_MINOR - the minor version of Lua +# LUA_VERSION_PATCH - the patch version of Lua +# +# Note that the expected include convention is +# #include "lua.h" +# and not +# #include <lua/lua.h> +# This is because, the lua location is not standardized and may exist +# in locations other than lua/ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# Copyright 2013 Rolf Eike Beer <eike@sf-mail.de> +# +# 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.) + +unset(_lua_include_subdirs) +unset(_lua_library_names) + +# this is a function only to have all the variables inside go away automatically +function(set_lua_version_vars) + set(LUA_VERSIONS5 5.3 5.2 5.1 5.0) + + if (Lua_FIND_VERSION_EXACT) + if (Lua_FIND_VERSION_COUNT GREATER 1) + set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR}) + endif () + elseif (Lua_FIND_VERSION) + # once there is a different major version supported this should become a loop + if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) + if (Lua_FIND_VERSION_COUNT EQUAL 1) + set(lua_append_versions ${LUA_VERSIONS5}) + else () + foreach (subver IN LISTS LUA_VERSIONS5) + if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) + list(APPEND lua_append_versions ${subver}) + endif () + endforeach () + endif () + endif () + else () + # once there is a different major version supported this should become a loop + set(lua_append_versions ${LUA_VERSIONS5}) + endif () + + foreach (ver IN LISTS lua_append_versions) + string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") + list(APPEND _lua_include_subdirs + include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + list(APPEND _lua_library_names + lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} + lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} + ) + endforeach () + + set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) + set(_lua_library_names "${_lua_library_names}" PARENT_SCOPE) +endfunction(set_lua_version_vars) + +set_lua_version_vars() + +find_path(LUA_INCLUDE_DIR lua.h + HINTS + ENV LUA_DIR + PATH_SUFFIXES ${_lua_include_subdirs} include/lua include + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) +unset(_lua_include_subdirs) + +find_library(LUA_LIBRARY + NAMES ${_lua_library_names} lua + HINTS + ENV LUA_DIR + PATH_SUFFIXES lib + PATHS + ~/Library/Frameworks + /Library/Frameworks + /sw + /opt/local + /opt/csw + /opt +) +unset(_lua_library_names) + +if (LUA_LIBRARY) + # include the math library for Unix + if (UNIX AND NOT APPLE AND NOT BEOS) + find_library(LUA_MATH_LIBRARY m) + set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") + # For Windows and Mac, don't need to explicitly include the math library + else () + set(LUA_LIBRARIES "${LUA_LIBRARY}") + endif () +endif () + +if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") + # At least 5.[012] have different ways to express the version + # so all of them need to be tested. Lua 5.2 defines LUA_VERSION + # and LUA_RELEASE as joined by the C preprocessor, so avoid those. + file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_strings + REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") + + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") + if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") + set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") + else () + string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") + string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") + endif () + string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") + endif () + + unset(lua_version_strings) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua + REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR + VERSION_VAR LUA_VERSION_STRING) + +mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 9851f67..b610438 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -138,6 +138,8 @@ if(WIN32 AND NOT CYGWIN) select_library_configurations(LIB_EAY) select_library_configurations(SSL_EAY) + mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE + SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) elseif(MINGW) # same player, for MinGW diff --git a/Modules/FindPythonInterp.cmake b/Modules/FindPythonInterp.cmake index 7fb65b8..b6b7897 100644 --- a/Modules/FindPythonInterp.cmake +++ b/Modules/FindPythonInterp.cmake @@ -36,28 +36,30 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) if(PythonInterp_FIND_VERSION) - if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}") - string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") - list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ}) + if(PythonInterp_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION_MAJOR}.${PythonInterp_FIND_VERSION_MINOR}") + list(APPEND _Python_NAMES + python${_PYTHON_FIND_MAJ_MIN} + python${PythonInterp_FIND_VERSION_MAJOR}) unset(_PYTHON_FIND_OTHER_VERSIONS) if(NOT PythonInterp_FIND_VERSION_EXACT) - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION}) - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS}) + list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION_MAJOR}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) endif() +message(STATUS "names ${_Python_NAMES}") +message(STATUS "other versions ${_PYTHON_FIND_OTHER_VERSIONS}") list(APPEND _Python_NAMES python) # Search for the current active python version first diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index bffa9fb..8356ed9 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -41,9 +41,8 @@ set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0) set(_PYTHON3_VERSIONS 3.3 3.2 3.1 3.0) if(PythonLibs_FIND_VERSION) - if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$") - string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}") - string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}") + if(PythonLibs_FIND_VERSION_COUNT GREATER 1) + set(_PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION_MAJOR}.${PythonLibs_FIND_VERSION_MINOR}") unset(_PYTHON_FIND_OTHER_VERSIONS) if(PythonLibs_FIND_VERSION_EXACT) if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION) @@ -52,16 +51,15 @@ if(PythonLibs_FIND_VERSION) set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}") endif() else() - foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS}) + foreach(_PYTHON_V ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN) list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V}) endif() endforeach() endif() unset(_PYTHON_FIND_MAJ_MIN) - unset(_PYTHON_FIND_MAJ) else() - set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS}) + set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION_MAJOR}_VERSIONS}) endif() else() set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS}) diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 37a894c..28c1b64 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -475,6 +475,8 @@ if(wxWidgets_FIND_STYLE STREQUAL "win32") # settings. if(MINGW) set(WX_LIB_DIR_PREFIX gcc) + elseif(CMAKE_CL_64) + set(WX_LIB_DIR_PREFIX vc_x64) else() set(WX_LIB_DIR_PREFIX vc) endif() diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake index 798c44c..afeb9c5 100644 --- a/Modules/FortranCInterface/Detect.cmake +++ b/Modules/FortranCInterface/Detect.cmake @@ -49,7 +49,7 @@ unset(FortranCInterface_COMPILED CACHE) # Locate the sample project executable. if(FortranCInterface_COMPILED) find_program(FortranCInterface_EXE - NAMES FortranCInterface + NAMES FortranCInterface${CMAKE_EXECUTABLE_SUFFIX} PATHS ${FortranCInterface_BINARY_DIR} ${FortranCInterface_BINARY_DIR}/Debug NO_DEFAULT_PATH ) diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 4ef14ac..b2fda09 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -1,6 +1,5 @@ # - Function for generation of export macros for libraries -# This module provides the function GENERATE_EXPORT_HEADER() and the -# accompanying ADD_COMPILER_EXPORT_FLAGS() function. +# This module provides the function GENERATE_EXPORT_HEADER(). # # The GENERATE_EXPORT_HEADER function can be used to generate a file suitable # for preprocessor inclusion which contains EXPORT macros to be used in @@ -18,20 +17,17 @@ # [PREFIX_NAME <prefix_name>] # ) # -# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# The target properties CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN +# can be used to add the appropriate compile flags for targets. See the +# documentation of those target properties, and the convenience variables +# CMAKE_CXX_VISIBILITY_PRESET and CMAKE_VISIBILITY_INLINES_HIDDEN. # # By default GENERATE_EXPORT_HEADER() generates macro names in a file name -# determined by the name of the library. The ADD_COMPILER_EXPORT_FLAGS function -# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on -# Windows which does not need extra compiler flags for exporting support. You -# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will -# be populated with the required CXX_FLAGS required to enable visibility support -# for the compiler/architecture in use. +# determined by the name of the library. This means that in the simplest case, +# users of generate_export_header will be equivalent to: # -# This means that in the simplest case, users of these functions will be -# equivalent to: -# -# add_compiler_export_flags() +# set(CMAKE_CXX_VISIBILITY_PRESET hidden) +# set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) # add_library(somelib someclass.cpp) # generate_export_header(somelib) # install(TARGETS somelib DESTINATION ${LIBRARY_INSTALL_DIR}) @@ -128,6 +124,20 @@ # generate_export_header(somelib PREFIX_NAME VTK_) # # Generates the macros VTK_SOMELIB_EXPORT etc. +# +# +# ADD_COMPILER_EXPORT_FLAGS( [<output_variable>] ) +# +# The ADD_COMPILER_EXPORT_FLAGS function +# adds -fvisibility=hidden to CMAKE_CXX_FLAGS if supported, and is a no-op on +# Windows which does not need extra compiler flags for exporting support. You +# may optionally pass a single argument to ADD_COMPILER_EXPORT_FLAGS that will +# be populated with the required CXX_FLAGS required to enable visibility support +# for the compiler/architecture in use. +# +# This function is deprecated. Set the target properties CXX_VISIBILITY_PRESET +# and VISIBILITY_INLINES_HIDDEN instead. +# #============================================================================= # Copyright 2011 Stephen Kelly <steveire@gmail.com> @@ -326,6 +336,17 @@ function(GENERATE_EXPORT_HEADER TARGET_LIBRARY) endfunction() function(add_compiler_export_flags) + if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.12) + if(CMAKE_WARN_DEPRECATED) + set(messageType WARNING) + endif() + if(CMAKE_ERROR_DEPRECATED) + set(messageType FATAL_ERROR) + endif() + if(messageType) + message(${messageType} "The add_compiler_export_flags function is obsolete. Use the CXX_VISIBILITY_PRESET and VISIBILITY_INLINES_HIDDEN target properties instead.") + endif() + endif() _test_compiler_hidden_visibility() _test_compiler_has_deprecated() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 0930880..72844b5 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -294,6 +294,15 @@ endif() # set up the default search directories for frameworks set(CMAKE_SYSTEM_FRAMEWORK_PATH ~/Library/Frameworks + ) +if(_CMAKE_OSX_SYSROOT_PATH) + list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH + ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks + ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks + ) +endif() +list(APPEND CMAKE_SYSTEM_FRAMEWORK_PATH /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 8cb7fd5..7036ba0 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -124,8 +124,15 @@ endif() set(CMAKE_BUILD_TYPE_INIT Debug) if(WINCE) - string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER) - string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER) + foreach(lang C CXX) + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") + if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "THUMB") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") + elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") + endif() + string(TOUPPER "${_MSVC_${lang}_ARCHITECTURE_FAMILY}" _MSVC_${lang}_ARCHITECTURE_FAMILY_UPPER) + endforeach() if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") @@ -136,15 +143,15 @@ if(WINCE) endif() set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") - set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_") - set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_") + set(_PLATFORM_DEFINES_C " /D${_MSVC_C_ARCHITECTURE_FAMILY} /D_${_MSVC_C_ARCHITECTURE_FAMILY_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${_MSVC_CXX_ARCHITECTURE_FAMILY} /D_${_MSVC_CXX_ARCHITECTURE_FAMILY_UPPER}_") set(_RTC1 "") set(_FLAGS_CXX " /GR /EHsc") set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") - if (MSVC_VERSION LESS 1500) + if (MSVC_VERSION LESS 1600) set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") endif () else() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index c0fd07c..c9635b5 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -49,6 +49,11 @@ # # add_jar(example ENTRY_POINT com/examples/MyProject/Main) # +# To define a custom manifest for the jar, you can set it with the manifest +# named argument: +# +# add_jar(example MANIFEST /path/to/manifest) +# # To add a VERSION to the target output name you can set it using # the VERSION named argument to add_jar. This will create a jar file with the # name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar @@ -246,7 +251,7 @@ function(add_jar _TARGET_NAME) cmake_parse_arguments(_add_jar "" - "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" "SOURCES;INCLUDE_JARS" ${ARGN} ) @@ -262,6 +267,11 @@ function(add_jar _TARGET_NAME) set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) endif () + if (_add_jar_MANIFEST) + set(_MANIFEST_OPTION m) + set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + endif () + if (LIBRARY_OUTPUT_PATH) set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) else () @@ -405,7 +415,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} @@ -425,7 +435,7 @@ function(add_jar _TARGET_NAME) add_custom_command( OUTPUT ${_JAVA_JAR_OUTPUT_PATH} COMMAND ${Java_JAR_EXECUTABLE} - -cf${_ENTRY_POINT_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} ${_JAVA_RESOURCE_FILES} @java_class_filelist COMMAND ${CMAKE_COMMAND} -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in index 80a879d..118de16 100644 --- a/Modules/exportheader.cmake.in +++ b/Modules/exportheader.cmake.in @@ -23,8 +23,14 @@ #ifndef @DEPRECATED_MACRO_NAME@ # define @DEPRECATED_MACRO_NAME@ @DEFINE_DEPRECATED@ -# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@ -# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEFINE_DEPRECATED@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_EXPORT +# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT +# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ #endif #cmakedefine01 DEFINE_NO_DEPRECATED diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cf3c2a0..e7d0bb7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,6 +1,6 @@ # CMake version number components. set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) -set(CMake_VERSION_PATCH 11) -set(CMake_VERSION_TWEAK 20130918) +set(CMake_VERSION_PATCH 12) +set(CMake_VERSION_TWEAK 20131007) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index 8fafef9..5cb2280 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -160,9 +160,10 @@ protected: * CPack specific generator may mangle CPACK_PACKAGE_FILE_NAME * with CPACK_COMPONENT_xxxx_<NAME>_DISPLAY_NAME if * CPACK_<GEN>_USE_DISPLAY_NAME_IN_FILENAME is ON. - * @param[in] initialPackageFileName - * @param[in] groupOrComponentName - * @param[in] isGroupName + * @param[in] initialPackageFileName the initial package name to be mangled + * @param[in] groupOrComponentName the name of the group/component + * @param[in] isGroupName true if previous name refers to a group, + * false otherwise */ virtual std::string GetComponentPackageFileName( const std::string& initialPackageFileName, @@ -172,7 +173,7 @@ protected: /** * Package the list of files and/or components which * has been prepared by the beginning of DoPackage. - * @pre @ref toplevel has been filled-in + * @pre the @ref toplevel has been filled-in * @pre the list of file @ref files has been populated * @pre packageFileNames contains at least 1 entry * @post packageFileNames may have been updated and contains diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 497774d..85d7a56 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -249,7 +249,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "ADD_TEST";} + virtual const char* GetName() const { return "add_test";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } @@ -297,7 +297,7 @@ public: /** * The name of the command as specified in CMakeList.txt. */ - virtual const char* GetName() const { return "SET_TESTS_PROPERTIES";} + virtual const char* GetName() const { return "set_tests_properties";} // Unused methods virtual const char* GetTerseDocumentation() const { return ""; } diff --git a/Source/CursesDialog/CMakeLists.txt b/Source/CursesDialog/CMakeLists.txt index 5efc2fb..548f5a5 100644 --- a/Source/CursesDialog/CMakeLists.txt +++ b/Source/CursesDialog/CMakeLists.txt @@ -11,6 +11,7 @@ #============================================================================= set( CURSES_SRCS + CursesDialog/cmCursesOptionsWidget CursesDialog/cmCursesBoolWidget CursesDialog/cmCursesCacheEntryComposite CursesDialog/cmCursesDummyWidget diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index c58d037..249137f 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmCursesCacheEntryComposite.h" +#include "cmCursesOptionsWidget.h" #include "cmCursesStringWidget.h" #include "cmCursesLabelWidget.h" #include "cmCursesBoolWidget.h" @@ -69,9 +70,27 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( it.GetValue()); break; case cmCacheManager::STRING: - this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); - static_cast<cmCursesStringWidget*>(this->Entry)->SetString( - it.GetValue()); + if(it.PropertyExists("STRINGS")) + { + cmCursesOptionsWidget* ow = + new cmCursesOptionsWidget(this->EntryWidth, 1, 1, 1); + this->Entry = ow; + std::vector<std::string> options; + cmSystemTools::ExpandListArgument( + std::string(it.GetProperty("STRINGS")), options); + for(std::vector<std::string>::iterator + si = options.begin(); si != options.end(); ++si) + { + ow->AddOption(*si); + } + ow->SetOption(it.GetValue()); + } + else + { + this->Entry = new cmCursesStringWidget(this->EntryWidth, 1, 1, 1); + static_cast<cmCursesStringWidget*>(this->Entry)->SetString( + it.GetValue()); + } break; case cmCacheManager::UNINITIALIZED: cmSystemTools::Error("Found an undefined variable: ", it.GetName()); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx new file mode 100644 index 0000000..652b2df --- /dev/null +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -0,0 +1,106 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 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 "cmCursesOptionsWidget.h" +#include "cmCursesMainForm.h" + +inline int ctrl(int z) +{ + return (z&037); +} + +cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, + int left, int top) : + cmCursesWidget(width, height, left, top) +{ + this->Type = cmCacheManager::BOOL; // this is a bit of a hack + // there is no option type, and string type causes ccmake to cast + // the widget into a string widget at some point. BOOL is safe for + // now. + set_field_fore(this->Field, A_NORMAL); + set_field_back(this->Field, A_STANDOUT); + field_opts_off(this->Field, O_STATIC); +} + +bool cmCursesOptionsWidget::HandleInput(int& key, cmCursesMainForm*, WINDOW* w) +{ + + // 10 == enter + if (key == 10 || key == KEY_ENTER) + { + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + } + else if (key == KEY_LEFT || key == ctrl('b')) + { + touchwin(w); + wrefresh(w); + this->PreviousOption(); + return true; + } + else if (key == KEY_RIGHT || key == ctrl('f')) + { + this->NextOption(); + touchwin(w); + wrefresh(w); + return true; + } + else + { + return false; + } + return false; +} + +void cmCursesOptionsWidget::AddOption(std::string const & option ) +{ + this->Options.push_back(option); +} + +void cmCursesOptionsWidget::NextOption() +{ + this->CurrentOption++; + if(this->CurrentOption > this->Options.size()-1) + { + this->CurrentOption = 0; + } + this->SetValue(this->Options[this->CurrentOption].c_str()); +} +void cmCursesOptionsWidget::PreviousOption() +{ + if(this->CurrentOption == 0) + { + this->CurrentOption = this->Options.size()-1; + } + else + { + this->CurrentOption--; + } + this->SetValue(this->Options[this->CurrentOption].c_str()); +} + +void cmCursesOptionsWidget::SetOption(const char* value) +{ + this->CurrentOption = 0; // default to 0 index + this->SetValue(value); + int index = 0; + for(std::vector<std::string>::iterator i = this->Options.begin(); + i != this->Options.end(); ++i) + { + if(*i == value) + { + this->CurrentOption = index; + } + index++; + } +} diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h new file mode 100644 index 0000000..b52ac9d --- /dev/null +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -0,0 +1,39 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2000-2009 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 __cmCursesOptionsWidget_h +#define __cmCursesOptionsWidget_h + +#include "cmCursesWidget.h" +class cmCursesMainForm; + +class cmCursesOptionsWidget : public cmCursesWidget +{ +public: + cmCursesOptionsWidget(int width, int height, int left, int top); + + // Description: + // Handle user input. Called by the container of this widget + // when this widget has focus. Returns true if the input was + // handled. + virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); + void SetOption(const char*); + void AddOption(std::string const &); + void NextOption(); + void PreviousOption(); +protected: + cmCursesOptionsWidget(const cmCursesOptionsWidget& from); + void operator=(const cmCursesOptionsWidget&); + std::vector<std::string> Options; + std::vector<std::string>::size_type CurrentOption; +}; + +#endif // __cmCursesOptionsWidget_h diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 4d62f72..a4dfdc9 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -66,9 +66,8 @@ CMakeSetupDialog::CMakeSetupDialog() // create the GUI QSettings settings; settings.beginGroup("Settings/StartPath"); - int h = settings.value("Height", 500).toInt(); - int w = settings.value("Width", 700).toInt(); - this->resize(w, h); + restoreGeometry(settings.value("geometry").toByteArray()); + restoreState(settings.value("windowState").toByteArray()); this->AddVariableCompletions = settings.value("AddVariableCompletionEntries", QStringList("CMAKE_INSTALL_PREFIX")).toStringList(); @@ -299,8 +298,8 @@ CMakeSetupDialog::~CMakeSetupDialog() { QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("Height", this->height()); - settings.setValue("Width", this->width()); + settings.setValue("windowState", QVariant(saveState())); + settings.setValue("geometry", QVariant(saveGeometry())); settings.setValue("SplitterSizes", this->Splitter->saveState()); // wait for thread to stop diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h index ed80067..148fd99 100644 --- a/Source/cmAddDependenciesCommand.h +++ b/Source/cmAddDependenciesCommand.h @@ -56,14 +56,14 @@ public: virtual const char* GetFullDocumentation() const { return - " add_dependencies(target-name depend-target1\n" - " depend-target2 ...)\n" - "Make a top-level target depend on other top-level targets. A " - "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. " + " add_dependencies(<target> [<target-dependency>]...)\n" + "Make a top-level <target> depend on other top-level targets to " + "ensure that they build before <target> does. " + "A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, " + "or ADD_CUSTOM_TARGET. " "Dependencies added to an IMPORTED target are followed transitively " "in its place since the target itself does not build. " + "\n" "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.h b/Source/cmAddTestCommand.h index ec7fda3..ce98aaa 100644 --- a/Source/cmAddTestCommand.h +++ b/Source/cmAddTestCommand.h @@ -66,7 +66,8 @@ public: "built by this project or an arbitrary executable on the " "system (like tclsh). The test will be run with the current working " "directory set to the CMakeList.txt files corresponding directory " - "in the binary tree.\n" + "in the binary tree. Tests added using this signature do not support " + "generator expressions.\n" "\n" " add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n" " [WORKING_DIRECTORY dir]\n" diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 086f27a..8dfaf3b 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -294,7 +294,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) cmVersion::GetPatchVersion(), cmVersion::GetTweakVersion()); if(def) { - fprintf(fout, "SET(CMAKE_MODULE_PATH %s)\n", def); + fprintf(fout, "set(CMAKE_MODULE_PATH %s)\n", def); } std::string projectLangs; @@ -307,35 +307,35 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if(const char* rulesOverridePath = this->Makefile->GetDefinition(rulesOverrideLang.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideLang.c_str(), rulesOverridePath); } else if(const char* rulesOverridePath2 = this->Makefile->GetDefinition(rulesOverrideBase.c_str())) { - fprintf(fout, "SET(%s \"%s\")\n", + fprintf(fout, "set(%s \"%s\")\n", rulesOverrideBase.c_str(), rulesOverridePath2); } } - fprintf(fout, "PROJECT(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); - fprintf(fout, "SET(CMAKE_VERBOSE_MAKEFILE 1)\n"); + fprintf(fout, "project(CMAKE_TRY_COMPILE%s)\n", projectLangs.c_str()); + fprintf(fout, "set(CMAKE_VERBOSE_MAKEFILE 1)\n"); for(std::set<std::string>::iterator li = testLangs.begin(); li != testLangs.end(); ++li) { std::string langFlags = "CMAKE_" + *li + "_FLAGS"; const char* flags = this->Makefile->GetDefinition(langFlags.c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(), + fprintf(fout, "set(CMAKE_%s_FLAGS %s)\n", li->c_str(), lg->EscapeForCMake(flags?flags:"").c_str()); - fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" + fprintf(fout, "set(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}" " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str()); } - fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n"); - fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n"); - fprintf(fout, "LINK_DIRECTORIES(${LINK_DIRECTORIES})\n"); + fprintf(fout, "include_directories(${INCLUDE_DIRECTORIES})\n"); + fprintf(fout, "set(CMAKE_SUPPRESS_REGENERATION 1)\n"); + fprintf(fout, "link_directories(${LINK_DIRECTORIES})\n"); // handle any compile flags we need to pass on if (compileDefs.size()) { - fprintf(fout, "ADD_DEFINITIONS( "); + fprintf(fout, "add_definitions( "); for (size_t i = 0; i < compileDefs.size(); ++i) { fprintf(fout,"%s ",compileDefs[i].c_str()); @@ -406,14 +406,14 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) } if(this->Makefile->GetDefinition("CMAKE_POSITION_INDEPENDENT_CODE")!=0) { - fprintf(fout, "SET(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); + fprintf(fout, "set(CMAKE_POSITION_INDEPENDENT_CODE \"ON\")\n"); } /* Put the executable at a known location (for COPY_FILE). */ - fprintf(fout, "SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", + fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); /* Create the actual executable. */ - fprintf(fout, "ADD_EXECUTABLE(%s", targetName); + fprintf(fout, "add_executable(%s", targetName); for(std::vector<std::string>::iterator si = sources.begin(); si != sources.end(); ++si) { @@ -429,11 +429,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if (useOldLinkLibs) { fprintf(fout, - "TARGET_LINK_LIBRARIES(%s ${LINK_LIBRARIES})\n",targetName); + "target_link_libraries(%s ${LINK_LIBRARIES})\n",targetName); } else { - fprintf(fout, "TARGET_LINK_LIBRARIES(%s %s)\n", + fprintf(fout, "target_link_libraries(%s %s)\n", targetName, libsToLink.c_str()); } diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 46cd77e..7bab741 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -40,6 +40,9 @@ "is exported using export(), or when the target is used by another " \ "target in the same buildsystem. Expands to the empty string " \ "otherwise.\n" \ + " $<PLATFORM_ID> = The CMake-id of the platform " \ + " $<PLATFORM_ID:comp> = '1' if the The CMake-id of the " \ + "platform matches comp, otherwise '0'.\n" \ " $<C_COMPILER_ID> = The CMake-id of the C compiler " \ "used.\n" \ " $<C_COMPILER_ID:comp> = '1' if the CMake-id of the C " \ diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index d3721bb..c01a66e 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -428,7 +428,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "PROJECT command.",false, "Variables that Provide Information"); cm->DefineProperty - ("[Project name]_BINARY_DIR", cmProperty::VARIABLE, + ("<PROJECT-NAME>_BINARY_DIR", cmProperty::VARIABLE, "Top level binary directory for the named project.", "A variable is created with the name used in the PROJECT " "command, and is the binary directory for the project. " @@ -436,7 +436,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "several projects.",false, "Variables that Provide Information"); cm->DefineProperty - ("[Project name]_SOURCE_DIR", cmProperty::VARIABLE, + ("<PROJECT-NAME>_SOURCE_DIR", cmProperty::VARIABLE, "Top level source directory for the named project.", "A variable is created with the name used in the PROJECT " "command, and is the source directory for the project." @@ -1477,7 +1477,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "On most compilers this is \"-L\".",false, "Variables that Control the Build"); cm->DefineProperty - ("CMAKE_LINK_DEF_FILE_FLAG ", cmProperty::VARIABLE, + ("CMAKE_LINK_DEF_FILE_FLAG", cmProperty::VARIABLE, "Linker flag to be used to specify a .def file for dll creation.", "The flag will be used to add a .def file when creating " "a dll on Windows; this is only defined on Windows." @@ -1586,6 +1586,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "See that target property for additional information.", false, "Variables that Control the Build"); + cm->DefineProperty + ("CMAKE_MAP_IMPORTED_CONFIG_<CONFIG>", cmProperty::VARIABLE, + "Default value for MAP_IMPORTED_CONFIG_<CONFIG> of targets.", + "This variable is used to initialize the " + "MAP_IMPORTED_CONFIG_<CONFIG> property on all the targets. " + "See that target property for additional information.", + false, + "Variables that Control the Build"); // Variables defined when the a language is enabled These variables will // also be defined whenever CMake has loaded its support for compiling (LANG) @@ -1861,7 +1869,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Variables for Languages"); cm->DefineProperty - ("CMAKE_<LANG>_LINK_EXECUTABLE ", cmProperty::VARIABLE, + ("CMAKE_<LANG>_LINK_EXECUTABLE", cmProperty::VARIABLE, "Rule variable to link an executable.", "Rule variable to link an executable for the given language." ,false, @@ -1948,8 +1956,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_INFORMATION_LOADED", cmProperty::VARIABLE,0,0); - cm->DefineProperty("CMAKE_<LANG>_LINK_EXECUTABLE", - cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_LINK_FLAGS", cmProperty::VARIABLE,0,0); cm->DefineProperty("CMAKE_<LANG>_RESPONSE_FILE_LINK_FLAG", diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 4edacbb..58ce36b 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -829,10 +829,10 @@ int cmDocumentation::GetStructuredDocFromFile( std::vector<cmDocumentationEntry>& commands, cmake* cm) { - typedef enum sdoce { + enum sdoce { SDOC_NONE, SDOC_MODULE, SDOC_MACRO, SDOC_FUNCTION, SDOC_VARIABLE, SDOC_SECTION, - SDOC_UNKNOWN} sdoc_t; + SDOC_UNKNOWN}; int nbDocItemFound = 0; int docCtxIdx = 0; std::vector<int> docContextStack(60); @@ -1617,7 +1617,7 @@ bool cmDocumentation::PrintDocumentationSinglePolicy(std::ostream& os) return true; } - // Argument was not a command. Complain. + // Argument was not a policy. Complain. os << "Argument \"" << this->CurrentArgument.c_str() << "\" to --help-policy is not a CMake policy.\n"; return false; @@ -1639,7 +1639,7 @@ bool cmDocumentation::PrintDocumentationSingleVariable(std::ostream& os) return true; } - // Argument was not a command. Complain. + // Argument was not a variable. Complain. os << "Argument \"" << this->CurrentArgument.c_str() << "\" to --help-variable is not a defined variable. " << "Use --help-variable-list to see all defined variables.\n"; diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index ef336ea..0a93533 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -736,9 +736,10 @@ cmExportFileGenerator "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages, properties, missingTargets); + std::vector<std::string> dummy; this->SetImportLinkProperty(suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", - iface->SharedDeps, properties, missingTargets); + iface->SharedDeps, properties, dummy); if(iface->Multiplicity > 0) { std::string prop = "IMPORTED_LINK_INTERFACE_MULTIPLICITY"; diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index c97d4ff..c8b4a79 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -162,7 +162,7 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os) if (require2_8_12) { - this->GenerateRequiredCMakeVersion(os, "2.8.11.20130626"); + this->GenerateRequiredCMakeVersion(os, "2.8.12"); } // Now load per-configuration properties for them. diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx index f07b783..e3b1626 100644 --- a/Source/cmExportLibraryDependencies.cxx +++ b/Source/cmExportLibraryDependencies.cxx @@ -169,7 +169,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const const char* vertest = "\"${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}\" GREATER 2.4"; fout << "# Generated by CMake " << cmVersion::GetCMakeVersion() << "\n\n"; - fout << "IF(" << vertest << ")\n"; + fout << "if(" << vertest << ")\n"; fout << " # Information for CMake 2.6 and above.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsNew.begin(); @@ -177,10 +177,10 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ELSE(" << vertest << ")\n"; + fout << "else()\n"; fout << " # Information for CMake 2.4 and lower.\n"; for(std::map<cmStdString, cmStdString>::const_iterator i = libDepsOld.begin(); @@ -188,7 +188,7 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(!i->second.empty()) { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } for(std::map<cmStdString, cmStdString>::const_iterator i = libTypes.begin(); @@ -196,9 +196,9 @@ void cmExportLibraryDependenciesCommand::ConstFinalPass() const { if(i->second != "general") { - fout << " SET(\"" << i->first << "\" \"" << i->second << "\")\n"; + fout << " set(\"" << i->first << "\" \"" << i->second << "\")\n"; } } - fout << "ENDIF(" << vertest << ")\n"; + fout << "endif()\n"; return; } diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 127cf6b..97853f3 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -71,7 +71,7 @@ const char *cmCompiledGeneratorExpression::Evaluate( cmTarget *currentTarget, cmGeneratorExpressionDAGChecker *dagChecker) const { - if (!this->NeedsParsing) + if (!this->NeedsEvaluation) { return this->Input.c_str(); } @@ -129,9 +129,9 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmGeneratorExpressionLexer l; std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input.c_str()); - this->NeedsParsing = l.GetSawGeneratorExpression(); + this->NeedsEvaluation = l.GetSawGeneratorExpression(); - if (this->NeedsParsing) + if (this->NeedsEvaluation) { cmGeneratorExpressionParser p(tokens); p.Parse(this->Evaluators); @@ -238,9 +238,12 @@ static void prefixItems(const std::string &content, std::string &result, { std::vector<std::string> entries; cmGeneratorExpression::Split(content, entries); + const char *sep = ""; for(std::vector<std::string>::const_iterator ei = entries.begin(); ei != entries.end(); ++ei) { + result += sep; + sep = ";"; if (!cmSystemTools::FileIsFullPath(ei->c_str()) && cmGeneratorExpression::Find(*ei) == std::string::npos) { diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index c20f130..bc0f6c2 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -126,7 +126,7 @@ private: cmListFileBacktrace Backtrace; std::vector<cmGeneratorExpressionEvaluator*> Evaluators; const std::string Input; - bool NeedsParsing; + bool NeedsEvaluation; mutable std::set<cmTarget*> DependTargets; mutable std::set<cmTarget*> AllTargetsSeen; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index abe4e70..7fd0fdc 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -438,6 +438,39 @@ static const struct CxxCompilerVersionNode : public CompilerVersionNode //---------------------------------------------------------------------------- +struct PlatformIdNode : public cmGeneratorExpressionNode +{ + PlatformIdNode() {} + + virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; } + + std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + const char *platformId = context->Makefile ? + context->Makefile->GetSafeDefinition( + "CMAKE_SYSTEM_NAME") : ""; + if (parameters.size() == 0) + { + return platformId ? platformId : ""; + } + + if (!platformId) + { + return parameters.front().empty() ? "1" : "0"; + } + + if (cmsysString_strcasecmp(parameters.begin()->c_str(), platformId) == 0) + { + return "1"; + } + return "0"; + } +} platformIdNode; + +//---------------------------------------------------------------------------- static const struct VersionGreaterNode : public cmGeneratorExpressionNode { VersionGreaterNode() {} @@ -1356,6 +1389,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return &cCompilerVersionNode; else if (identifier == "CXX_COMPILER_VERSION") return &cxxCompilerVersionNode; + else if (identifier == "PLATFORM_ID") + return &platformIdNode; else if (identifier == "CONFIGURATION") return &configurationNode; else if (identifier == "CONFIG") diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7f2b592..799bbdb 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -146,9 +146,17 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang, const char* cname = this->GetCMakeInstance()-> GetCacheManager()->GetCacheValue(langComp.c_str()); std::string changeVars; - if(cname && (path != cname) && (optional==false)) + if(cname && !optional) { - std::string cnameString = cname; + std::string cnameString; + if(!cmSystemTools::FileIsFullPath(cname)) + { + cnameString = cmSystemTools::FindProgram(cname); + } + else + { + cnameString = cname; + } std::string pathString = path; // get rid of potentially multiple slashes: cmSystemTools::ConvertToUnixSlashes(cnameString); diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 88cd6e5..3a9dc44 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -281,7 +281,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the generator name cmakefileStream << "# The generator used is:\n" - << "SET(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; + << "set(CMAKE_DEPENDS_GENERATOR \"" << this->GetName() << "\")\n\n"; // for each cmMakefile get its list of dependencies std::vector<std::string> lfiles; @@ -312,7 +312,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Save the list to the cmake file. cmakefileStream << "# The top level Makefile was generated from the following files:\n" - << "SET(CMAKE_MAKEFILE_DEPENDS\n" + << "set(CMAKE_MAKEFILE_DEPENDS\n" << " \"" << lg->Convert(cache.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"; @@ -335,7 +335,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() // Set the corresponding makefile in the cmake file. cmakefileStream << "# The corresponding makefile is:\n" - << "SET(CMAKE_MAKEFILE_OUTPUTS\n" + << "set(CMAKE_MAKEFILE_OUTPUTS\n" << " \"" << lg->Convert(makefileName.c_str(), cmLocalGenerator::START_OUTPUT).c_str() << "\"\n" @@ -348,7 +348,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile() { cmakefileStream << "# Byproducts of CMake generate step:\n" - << "SET(CMAKE_MAKEFILE_PRODUCTS\n"; + << "set(CMAKE_MAKEFILE_PRODUCTS\n"; const std::vector<std::string>& outfiles = lg->GetMakefile()->GetOutputFiles(); for(std::vector<std::string>::const_iterator k = outfiles.begin(); @@ -390,7 +390,7 @@ void cmGlobalUnixMakefileGenerator3 cmakefileStream << "# Dependency information for all targets:\n"; cmakefileStream - << "SET(CMAKE_DEPEND_INFO_FILES\n"; + << "set(CMAKE_DEPEND_INFO_FILES\n"; for (unsigned int i = 0; i < lGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3 *>(lGenerators[i]); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index e4244e0..1a4c7ff 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -202,7 +202,7 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddCheckTarget() +bool cmGlobalVisualStudio8Generator::AddCheckTarget() { // Add a special target on which all other targets depend that // checks the build system and optionally re-runs CMake. @@ -216,7 +216,7 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() // Skip the target if no regeneration is to be done. if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) { - return; + return false; } std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); @@ -315,21 +315,24 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget() cmSystemTools::Error("Error adding rule for ", stamps[0].c_str()); } } + + return true; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::Generate() { - this->AddCheckTarget(); - - // All targets depend on the build-system check target. - for(std::map<cmStdString,cmTarget *>::const_iterator - ti = this->TotalTargets.begin(); - ti != this->TotalTargets.end(); ++ti) + if(this->AddCheckTarget()) { - if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) + // All targets depend on the build-system check target. + for(std::map<cmStdString,cmTarget *>::const_iterator + ti = this->TotalTargets.begin(); + ti != this->TotalTargets.end(); ++ti) { - ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + if(ti->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) + { + ti->second->AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); + } } } diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index d181742..2376f8a 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -71,7 +71,7 @@ protected: virtual bool VSLinksDependencies() const { return false; } - void AddCheckTarget(); + bool AddCheckTarget(); static cmIDEFlagTable const* GetExtraFlagTableVS8(); virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 7cb2d1f..0a2b32b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -431,13 +431,16 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, // Add XCODE depend helper std::string dir = mf->GetCurrentOutputDirectory(); - cmCustomCommandLine makecommand; - makecommand.push_back("make"); - makecommand.push_back("-C"); - makecommand.push_back(dir.c_str()); - makecommand.push_back("-f"); - makecommand.push_back(this->CurrentXCodeHackMakefile.c_str()); - makecommand.push_back(""); // placeholder, see below + cmCustomCommandLine makeHelper; + if(this->XcodeVersion < 50) + { + makeHelper.push_back("make"); + makeHelper.push_back("-C"); + makeHelper.push_back(dir.c_str()); + makeHelper.push_back("-f"); + makeHelper.push_back(this->CurrentXCodeHackMakefile.c_str()); + makeHelper.push_back(""); // placeholder, see below + } // Add ZERO_CHECK bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION"); @@ -477,17 +480,18 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, // run the depend check makefile as a post build rule // this will make sure that when the next target is built // things are up-to-date - if((target.GetType() == cmTarget::EXECUTABLE || + if(!makeHelper.empty() && + (target.GetType() == cmTarget::EXECUTABLE || // Nope - no post-build for OBJECT_LIRBRARY // target.GetType() == cmTarget::OBJECT_LIBRARY || target.GetType() == cmTarget::STATIC_LIBRARY || target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY)) { - makecommand[makecommand.size()-1] = + makeHelper[makeHelper.size()-1] = // fill placeholder this->PostBuildMakeTarget(target.GetName(), "$(CONFIGURATION)"); cmCustomCommandLines commandLines; - commandLines.push_back(makecommand); + commandLines.push_back(makeHelper); lg->GetMakefile()->AddCustomCommandToTarget(target.GetName(), no_depends, commandLines, @@ -1027,18 +1031,21 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, } } - // Add object library contents as external objects. (Equivalent to - // the externalObjFiles above, except each one is not a cmSourceFile - // within the target.) - std::vector<std::string> objs; - this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs); - for(std::vector<std::string>::const_iterator - oi = objs.begin(); oi != objs.end(); ++oi) + if(this->XcodeVersion < 50) { - std::string obj = *oi; - cmXCodeObject* xsf = - this->CreateXCodeSourceFileFromPath(obj, cmtarget, ""); - externalObjFiles.push_back(xsf); + // Add object library contents as external objects. (Equivalent to + // the externalObjFiles above, except each one is not a cmSourceFile + // within the target.) + std::vector<std::string> objs; + this->GetGeneratorTarget(&cmtarget)->UseObjectLibraries(objs); + for(std::vector<std::string>::const_iterator + oi = objs.begin(); oi != objs.end(); ++oi) + { + std::string obj = *oi; + cmXCodeObject* xsf = + this->CreateXCodeSourceFileFromPath(obj, cmtarget, ""); + externalObjFiles.push_back(xsf); + } } // some build phases only apply to bundles and/or frameworks @@ -2765,13 +2772,6 @@ void cmGlobalXCodeGenerator } } - // Skip link information for static libraries. - if(cmtarget->GetType() == cmTarget::OBJECT_LIBRARY || - cmtarget->GetType() == cmTarget::STATIC_LIBRARY) - { - return; - } - // Loop over configuration types and set per-configuration info. for(std::vector<std::string>::iterator i = this->CurrentConfigurationTypes.begin(); @@ -2784,6 +2784,31 @@ void cmGlobalXCodeGenerator configName = 0; } + if(this->XcodeVersion >= 50) + { + // Add object library contents as link flags. + std::string linkObjs; + const char* sep = ""; + std::vector<std::string> objs; + this->GetGeneratorTarget(cmtarget)->UseObjectLibraries(objs); + for(std::vector<std::string>::const_iterator + oi = objs.begin(); oi != objs.end(); ++oi) + { + linkObjs += sep; + sep = " "; + linkObjs += this->XCodeEscapePath(oi->c_str()); + } + this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", + linkObjs.c_str(), configName); + } + + // Skip link information for object libraries. + if(cmtarget->GetType() == cmTarget::OBJECT_LIBRARY || + cmtarget->GetType() == cmTarget::STATIC_LIBRARY) + { + continue; + } + // Compute the link library and directory information. cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); if(!pcli) @@ -3338,8 +3363,11 @@ void cmGlobalXCodeGenerator cmXCodeObject* t = *i; this->AddDependAndLinkInformation(t); } - // now create xcode depend hack makefile - this->CreateXCodeDependHackTarget(targets); + if(this->XcodeVersion < 50) + { + // now create xcode depend hack makefile + this->CreateXCodeDependHackTarget(targets); + } // now add all targets to the root object cmXCodeObject* allTargets = this->CreateObject(cmXCodeObject::OBJECT_LIST); for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index 3e9e6ac..1287ea6 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -183,11 +183,11 @@ cmInstallExportGenerator::GenerateScriptConfigs(std::ostream& os, { files.push_back(i->second); std::string config_test = this->CreateConfigTest(i->first.c_str()); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->AddInstallRule(os, cmInstallType_FILES, files, false, this->FilePermissions.c_str(), 0, 0, 0, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif()\n"; files.clear(); } } @@ -202,23 +202,23 @@ void cmInstallExportGenerator::GenerateScriptActions(std::ostream& os, installedDir += "/"; std::string installedFile = installedDir; installedFile += this->FileName; - os << indent << "IF(EXISTS \"" << installedFile << "\")\n"; + os << indent << "if(EXISTS \"" << installedFile << "\")\n"; Indent indentN = indent.Next(); Indent indentNN = indentN.Next(); Indent indentNNN = indentNN.Next(); - os << indentN << "FILE(DIFFERENT EXPORT_FILE_CHANGED FILES\n" + os << indentN << "file(DIFFERENT EXPORT_FILE_CHANGED FILES\n" << indentN << " \"" << installedFile << "\"\n" << indentN << " \"" << this->MainImportFile << "\")\n"; - os << indentN << "IF(EXPORT_FILE_CHANGED)\n"; - os << indentNN << "FILE(GLOB OLD_CONFIG_FILES \"" << installedDir + os << indentN << "if(EXPORT_FILE_CHANGED)\n"; + os << indentNN << "file(GLOB OLD_CONFIG_FILES \"" << installedDir << this->EFGen->GetConfigImportFileGlob() << "\")\n"; - os << indentNN << "IF(OLD_CONFIG_FILES)\n"; - os << indentNNN << "MESSAGE(STATUS \"Old export file \\\"" << installedFile + os << indentNN << "if(OLD_CONFIG_FILES)\n"; + os << indentNNN << "message(STATUS \"Old export file \\\"" << installedFile << "\\\" will be replaced. Removing files [${OLD_CONFIG_FILES}].\")\n"; - os << indentNNN << "FILE(REMOVE ${OLD_CONFIG_FILES})\n"; - os << indentNN << "ENDIF(OLD_CONFIG_FILES)\n"; - os << indentN << "ENDIF(EXPORT_FILE_CHANGED)\n"; - os << indent << "ENDIF()\n"; + os << indentNNN << "file(REMOVE ${OLD_CONFIG_FILES})\n"; + os << indentNN << "endif()\n"; + os << indentN << "endif()\n"; + os << indent << "endif()\n"; // Install the main export file. std::vector<std::string> files; diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx index 3be2c2b..d105a0c 100644 --- a/Source/cmInstallGenerator.cxx +++ b/Source/cmInstallGenerator.cxx @@ -80,18 +80,18 @@ void cmInstallGenerator } } os << "\")\n"; - os << indent << "IF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL " << "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; - os << indent << "IF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL " << "DESTINATION forbidden (by caller): " << "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n"; - os << indent << "ENDIF (CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n"; + os << indent << "endif()\n"; } - os << "FILE(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); + os << "file(INSTALL DESTINATION \"" << dest << "\" TYPE " << stype.c_str(); if(optional) { os << " OPTIONAL"; @@ -153,13 +153,13 @@ void cmInstallGenerator::GenerateScript(std::ostream& os) // Begin this block of installation. std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; // Generate the script possibly with per-configuration code. this->GenerateScriptConfigs(os, indent.Next()); // End this block of installation. - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } //---------------------------------------------------------------------------- diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index bcfbe63..1ecf021 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -32,7 +32,7 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) Indent indent; std::string component_test = this->CreateComponentTest(this->Component.c_str()); - os << indent << "IF(" << component_test << ")\n"; + os << indent << "if(" << component_test << ")\n"; if(this->Code) { @@ -40,8 +40,8 @@ void cmInstallScriptGenerator::GenerateScript(std::ostream& os) } else { - os << indent.Next() << "INCLUDE(\"" << this->Script << "\")\n"; + os << indent.Next() << "include(\"" << this->Script << "\")\n"; } - os << indent << "ENDIF(" << component_test << ")\n\n"; + os << indent << "endif()\n\n"; } diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index c9624c8..d0768c8 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -407,10 +407,10 @@ cmInstallTargetGenerator std::string tws = tw.str(); if(!tws.empty()) { - os << indent << "IF(EXISTS \"" << file << "\" AND\n" + os << indent << "if(EXISTS \"" << file << "\" AND\n" << indent << " NOT IS_SYMLINK \"" << file << "\")\n"; os << tws; - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } @@ -434,7 +434,7 @@ cmInstallTargetGenerator if(!tws.empty()) { Indent indent2 = indent.Next().Next(); - os << indent << "FOREACH(file\n"; + os << indent << "foreach(file\n"; for(std::vector<std::string>::const_iterator i = files.begin(); i != files.end(); ++i) { @@ -442,7 +442,7 @@ cmInstallTargetGenerator } os << indent2 << ")\n"; os << tws; - os << indent << "ENDFOREACH()\n"; + os << indent << "endforeach()\n"; } } } @@ -577,7 +577,7 @@ cmInstallTargetGenerator // install_name value and references. if(!new_id.empty() || !install_name_remap.empty()) { - os << indent << "EXECUTE_PROCESS(COMMAND \"" << installNameTool; + os << indent << "execute_process(COMMAND \"" << installNameTool; os << "\""; if(!new_id.empty()) { @@ -626,7 +626,7 @@ cmInstallTargetGenerator // Write a rule to remove the installed file if its rpath is not the // new rpath. This is needed for existing build/install trees when // the installed rpath changes but the file is not rebuilt. - os << indent << "FILE(RPATH_CHECK\n" + os << indent << "file(RPATH_CHECK\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " RPATH \"" << newRpath << "\")\n"; } @@ -697,12 +697,12 @@ cmInstallTargetGenerator // Write a rule to run chrpath to set the install-tree RPATH if(newRpath.empty()) { - os << indent << "FILE(RPATH_REMOVE\n" + os << indent << "file(RPATH_REMOVE\n" << indent << " FILE \"" << toDestDirPath << "\")\n"; } else { - os << indent << "FILE(RPATH_CHANGE\n" + os << indent << "file(RPATH_CHANGE\n" << indent << " FILE \"" << toDestDirPath << "\"\n" << indent << " OLD_RPATH \"" << oldRpath << "\"\n" << indent << " NEW_RPATH \"" << newRpath << "\")\n"; @@ -736,11 +736,11 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os, return; } - os << indent << "IF(CMAKE_INSTALL_DO_STRIP)\n"; - os << indent << " EXECUTE_PROCESS(COMMAND \"" + os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << " execute_process(COMMAND \"" << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") << "\" \"" << toDestDirPath << "\")\n"; - os << indent << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n"; + os << indent << "endif()\n"; } //---------------------------------------------------------------------------- @@ -769,6 +769,6 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, return; } - os << indent << "EXECUTE_PROCESS(COMMAND \"" + os << indent << "execute_process(COMMAND \"" << ranlib << "\" \"" << toDestDirPath << "\")\n"; } diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c index 2841fe5..f127add 100644 --- a/Source/cmListFileLexer.c +++ b/Source/cmListFileLexer.c @@ -2271,6 +2271,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer) /*--------------------------------------------------------------------------*/ static void cmListFileLexerDestroy(cmListFileLexer* lexer) { + cmListFileLexerSetToken(lexer, 0, 0); if(lexer->file || lexer->string_buffer) { cmListFileLexer_yylex_destroy(lexer->scanner); diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l index 12b53ee..bd3c1eb 100644 --- a/Source/cmListFileLexer.in.l +++ b/Source/cmListFileLexer.in.l @@ -292,6 +292,7 @@ static void cmListFileLexerInit(cmListFileLexer* lexer) /*--------------------------------------------------------------------------*/ static void cmListFileLexerDestroy(cmListFileLexer* lexer) { + cmListFileLexerSetToken(lexer, 0, 0); if(lexer->file || lexer->string_buffer) { cmListFileLexer_yylex_destroy(lexer->scanner); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 9c04109..afc04b9 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -297,7 +297,7 @@ void cmLocalGenerator::GenerateTestFiles() this->Makefile->GetProperty("TEST_INCLUDE_FILE"); if ( testIncludeFile ) { - fout << "INCLUDE(\"" << testIncludeFile << "\")" << std::endl; + fout << "include(\"" << testIncludeFile << "\")" << std::endl; } // Ask each test generator to write its code. @@ -313,7 +313,8 @@ void cmLocalGenerator::GenerateTestFiles() size_t i; for(i = 0; i < this->Children.size(); ++i) { - fout << "SUBDIRS("; + // TODO: Use add_subdirectory instead? + fout << "subdirs("; std::string outP = this->Children[i]->GetMakefile()->GetStartOutputDirectory(); fout << this->Convert(outP.c_str(),START_OUTPUT); @@ -416,39 +417,39 @@ void cmLocalGenerator::GenerateInstallRules() fout << "# Install script for directory: " << this->Makefile->GetCurrentDirectory() << std::endl << std::endl; fout << "# Set the install prefix" << std::endl - << "IF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << " SET(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl - << "ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl - << "STRING(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " + << "if(NOT DEFINED CMAKE_INSTALL_PREFIX)" << std::endl + << " set(CMAKE_INSTALL_PREFIX \"" << prefix << "\")" << std::endl + << "endif()" << std::endl + << "string(REGEX REPLACE \"/$\" \"\" CMAKE_INSTALL_PREFIX " << "\"${CMAKE_INSTALL_PREFIX}\")" << std::endl << std::endl; // Write support code for generating per-configuration install rules. fout << "# Set the install configuration name.\n" - "IF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" - " IF(BUILD_TYPE)\n" - " STRING(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" + "if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + " if(BUILD_TYPE)\n" + " string(REGEX REPLACE \"^[^A-Za-z0-9_]+\" \"\"\n" " CMAKE_INSTALL_CONFIG_NAME \"${BUILD_TYPE}\")\n" - " ELSE(BUILD_TYPE)\n" - " SET(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" - " ENDIF(BUILD_TYPE)\n" - " MESSAGE(STATUS \"Install configuration: " + " else()\n" + " set(CMAKE_INSTALL_CONFIG_NAME \"" << default_config << "\")\n" + " endif()\n" + " message(STATUS \"Install configuration: " "\\\"${CMAKE_INSTALL_CONFIG_NAME}\\\"\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)\n" + "endif()\n" "\n"; // Write support code for dealing with component-specific installs. fout << "# Set the component getting installed.\n" - "IF(NOT CMAKE_INSTALL_COMPONENT)\n" - " IF(COMPONENT)\n" - " MESSAGE(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" - " SET(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" - " ELSE(COMPONENT)\n" - " SET(CMAKE_INSTALL_COMPONENT)\n" - " ENDIF(COMPONENT)\n" - "ENDIF(NOT CMAKE_INSTALL_COMPONENT)\n" + "if(NOT CMAKE_INSTALL_COMPONENT)\n" + " if(COMPONENT)\n" + " message(STATUS \"Install component: \\\"${COMPONENT}\\\"\")\n" + " set(CMAKE_INSTALL_COMPONENT \"${COMPONENT}\")\n" + " else()\n" + " set(CMAKE_INSTALL_COMPONENT)\n" + " endif()\n" + "endif()\n" "\n"; // Copy user-specified install options to the install code. @@ -457,9 +458,9 @@ void cmLocalGenerator::GenerateInstallRules() { fout << "# Install shared libraries without execute permission?\n" - "IF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" - " SET(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" - "ENDIF(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + "if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)\n" + " set(CMAKE_INSTALL_SO_NO_EXE \"" << so_no_exe << "\")\n" + "endif()\n" "\n"; } @@ -479,7 +480,7 @@ void cmLocalGenerator::GenerateInstallRules() // Include install scripts from subdirectories. if(!this->Children.empty()) { - fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; + fout << "if(NOT CMAKE_INSTALL_LOCAL_ONLY)\n"; fout << " # Include the install script for each subdirectory.\n"; for(std::vector<cmLocalGenerator*>::const_iterator ci = this->Children.begin(); ci != this->Children.end(); ++ci) @@ -488,34 +489,34 @@ void cmLocalGenerator::GenerateInstallRules() { std::string odir = (*ci)->GetMakefile()->GetStartOutputDirectory(); cmSystemTools::ConvertToUnixSlashes(odir); - fout << " INCLUDE(\"" << odir.c_str() + fout << " include(\"" << odir.c_str() << "/cmake_install.cmake\")" << std::endl; } } fout << "\n"; - fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n\n"; + fout << "endif()\n\n"; } // Record the install manifest. if ( toplevel_install ) { fout << - "IF(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest_" + "if(CMAKE_INSTALL_COMPONENT)\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest_" "${CMAKE_INSTALL_COMPONENT}.txt\")\n" - "ELSE(CMAKE_INSTALL_COMPONENT)\n" - " SET(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" - "ENDIF(CMAKE_INSTALL_COMPONENT)\n\n"; + "else()\n" + " set(CMAKE_INSTALL_MANIFEST \"install_manifest.txt\")\n" + "endif()\n\n"; fout - << "FILE(WRITE \"" + << "file(WRITE \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"\")" << std::endl; fout - << "FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl - << " FILE(APPEND \"" + << "foreach(file ${CMAKE_INSTALL_MANIFEST_FILES})" << std::endl + << " file(APPEND \"" << homedir.c_str() << "/${CMAKE_INSTALL_MANIFEST}\" " << "\"${file}\\n\")" << std::endl - << "ENDFOREACH(file)" << std::endl; + << "endforeach()" << std::endl; } } diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index a522e37..89b05d7 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -17,7 +17,6 @@ #include "cmNinjaTargetGenerator.h" #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" -#include "cmComputeLinkInformation.h" #include "cmake.h" #include <assert.h> diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 56da1f9..2443583 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -474,9 +474,9 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() // Setup relative path conversion tops. infoFileStream << "# Relative path conversion top directories.\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource + << "set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"" << this->RelativePathTopSource << "\")\n" - << "SET(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary + << "set(CMAKE_RELATIVE_PATH_TOP_BINARY \"" << this->RelativePathTopBinary << "\")\n" << "\n"; @@ -485,7 +485,7 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() { infoFileStream << "# Force unix paths in dependencies.\n" - << "SET(CMAKE_FORCE_UNIX_PATHS 1)\n" + << "set(CMAKE_FORCE_UNIX_PATHS 1)\n" << "\n"; } @@ -495,21 +495,21 @@ void cmLocalUnixMakefileGenerator3::WriteDirectoryInformationFile() << "# The C and CXX include file regular expressions for " << "this directory.\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_SCAN "; + << "set(CMAKE_C_INCLUDE_REGEX_SCAN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetIncludeRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; + << "set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "; this->WriteCMakeArgument(infoFileStream, this->Makefile->GetComplainRegularExpression()); infoFileStream << ")\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; + << "set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})\n"; infoFileStream - << "SET(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " + << "set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN " "${CMAKE_C_INCLUDE_REGEX_COMPLAIN})\n"; } @@ -1176,7 +1176,7 @@ cmLocalUnixMakefileGenerator3 { cmSystemTools::Error("Could not create ", cleanfilePath.c_str()); } - fout << "FILE(REMOVE_RECURSE\n"; + fout << "file(REMOVE_RECURSE\n"; std::string remove = "$(CMAKE_COMMAND) -P "; remove += this->Convert(cleanfile.c_str(), START_OUTPUT, SHELL); for(std::vector<std::string>::const_iterator f = files.begin(); @@ -1196,16 +1196,16 @@ cmLocalUnixMakefileGenerator3 target.GetLanguages(languages); fout << "\n" << "# Per-language clean rules from dependency scanning.\n" - << "FOREACH(lang"; + << "foreach(lang"; for(std::set<cmStdString>::const_iterator l = languages.begin(); l != languages.end(); ++l) { fout << " " << *l; } fout << ")\n" - << " INCLUDE(" << this->GetTargetDirectory(target) + << " include(" << this->GetTargetDirectory(target) << "/cmake_clean_${lang}.cmake OPTIONAL)\n" - << "ENDFOREACH(lang)\n"; + << "endforeach()\n"; } } } @@ -1915,7 +1915,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "# The set of languages for which implicit dependencies are needed:\n"; cmakefileStream - << "SET(CMAKE_DEPENDS_LANGUAGES\n"; + << "set(CMAKE_DEPENDS_LANGUAGES\n"; for(ImplicitDependLanguageMap::const_iterator l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { @@ -1930,7 +1930,7 @@ void cmLocalUnixMakefileGenerator3 l = implicitLangs.begin(); l != implicitLangs.end(); ++l) { cmakefileStream - << "SET(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; + << "set(CMAKE_DEPENDS_CHECK_" << l->first.c_str() << "\n"; ImplicitDependFileMap const& implicitPairs = l->second; // for each file pair @@ -1954,7 +1954,7 @@ void cmLocalUnixMakefileGenerator3 if(cid && *cid) { cmakefileStream - << "SET(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" + << "set(CMAKE_" << l->first.c_str() << "_COMPILER_ID \"" << cid << "\")\n"; } } @@ -1968,7 +1968,7 @@ void cmLocalUnixMakefileGenerator3 cmakefileStream << "\n" << "# Preprocessor definitions for this target.\n" - << "SET(CMAKE_TARGET_DEFINITIONS\n"; + << "set(CMAKE_TARGET_DEFINITIONS\n"; for(std::set<std::string>::const_iterator di = defines.begin(); di != defines.end(); ++di) { @@ -1995,7 +1995,7 @@ void cmLocalUnixMakefileGenerator3 if(!transformRules.empty()) { cmakefileStream - << "SET(CMAKE_INCLUDE_TRANSFORMS\n"; + << "set(CMAKE_INCLUDE_TRANSFORMS\n"; for(std::vector<std::string>::const_iterator tri = transformRules.begin(); tri != transformRules.end(); ++tri) { diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index e5b4057..f00a937 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -147,7 +147,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() this->SetBuildType(UTILITY, l->first.c_str(), l->second); break; default: - cmSystemTools::Error("Bad target type", l->first.c_str()); + cmSystemTools::Error("Bad target type: ", l->first.c_str()); break; } // INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace @@ -165,7 +165,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile() dir += l->first.substr(0, pos); if(!cmSystemTools::MakeDirectory(dir.c_str())) { - cmSystemTools::Error("Error creating directory ", dir.c_str()); + cmSystemTools::Error("Error creating directory: ", dir.c_str()); } } this->CreateSingleDSP(l->first.c_str(),l->second); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index fd06a33..34541e9 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1069,6 +1069,19 @@ void cmMakefile::UpdateOutputToSourceMap(std::string const& output, cmSourceFile* source) { + OutputToSourceMap::iterator i = this->OutputToSource.find(output); + if(i != this->OutputToSource.end()) + { + // Multiple custom commands produce the same output but may + // be attached to a different source file (MAIN_DEPENDENCY). + // LinearGetSourceFileWithOutput would return the first one, + // so keep the mapping for the first one. + // + // TODO: Warn the user about this case. However, the VS 8 generator + // triggers it for separate generate.stamp rules in ZERO_CHECK and + // individual targets. + return; + } this->OutputToSource[output] = source; } diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0829cab..33974ae 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -21,6 +21,7 @@ #include "cmTarget.h" #include "cmake.h" #include "cmComputeLinkInformation.h" +#include "cmGeneratorExpression.h" #include "cmMakefileExecutableTargetGenerator.h" #include "cmMakefileLibraryTargetGenerator.h" @@ -131,7 +132,14 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules() this->Makefile->GetProperty ("ADDITIONAL_MAKE_CLEAN_FILES")) { - cmSystemTools::ExpandListArgument(additional_clean_files, + const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); + cmListFileBacktrace lfbt; + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = + ge.Parse(additional_clean_files); + + cmSystemTools::ExpandListArgument(cge->Evaluate(this->Makefile, config, + false, this->Target, 0, 0), this->CleanFiles); } @@ -968,7 +976,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Pairs of files generated by the same build rule.\n" - << "SET(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; + << "set(CMAKE_MULTIPLE_OUTPUT_PAIRS\n"; for(MultipleOutputPairsType::const_iterator pi = this->MultipleOutputPairs.begin(); pi != this->MultipleOutputPairs.end(); ++pi) @@ -986,7 +994,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Targets to which this target links.\n" - << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; + << "set(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set<cmTarget const*> emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) @@ -1018,7 +1026,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "\n" << "# Fortran module output directory.\n" - << "SET(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; + << "set(CMAKE_Fortran_TARGET_MODULE_DIR \"" << mdir << "\")\n"; } // Target-specific include directories: @@ -1026,7 +1034,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "\n" << "# The include file search paths:\n"; *this->InfoFileStream - << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; + << "set(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector<std::string> includes; const char *config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -1045,13 +1053,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << " )\n"; *this->InfoFileStream - << "SET(CMAKE_CXX_TARGET_INCLUDE_PATH " + << "set(CMAKE_CXX_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_Fortran_TARGET_INCLUDE_PATH " + << "set(CMAKE_Fortran_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; *this->InfoFileStream - << "SET(CMAKE_ASM_TARGET_INCLUDE_PATH " + << "set(CMAKE_ASM_TARGET_INCLUDE_PATH " << "${CMAKE_C_TARGET_INCLUDE_PATH})\n"; // and now write the rule to use it diff --git a/Source/cmMarkAsAdvancedCommand.h b/Source/cmMarkAsAdvancedCommand.h index 246eb8a..adfc553 100644 --- a/Source/cmMarkAsAdvancedCommand.h +++ b/Source/cmMarkAsAdvancedCommand.h @@ -56,7 +56,7 @@ public: virtual const char* GetFullDocumentation() const { return - " mark_as_advanced([CLEAR|FORCE] VAR VAR2 VAR...)\n" + " mark_as_advanced([CLEAR|FORCE] VAR [VAR2 ...])\n" "Mark the named cached variables as advanced. An advanced variable " "will not be displayed in any of the cmake GUIs unless the show " "advanced option is on. " diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index a823f05..f9197e0 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -27,11 +27,11 @@ public: cmPolicies::PolicyStatus status) { if (!idString || !shortDescription || ! longDescription) - { + { cmSystemTools::Error("Attempt to define a policy without " "all parameters being specified!"); return; - } + } this->ID = iD; this->IDString = idString; this->ShortDescription = shortDescription; @@ -61,29 +61,29 @@ public: unsigned int tweakV) { if (majorV < this->MajorVersionIntroduced) - { + { return true; - } + } if (majorV > this->MajorVersionIntroduced) - { + { return false; - } + } if (minorV < this->MinorVersionIntroduced) - { + { return true; - } + } if (minorV > this->MinorVersionIntroduced) - { + { return false; - } + } if (patchV < this->PatchVersionIntroduced) - { + { return true; - } + } if (patchV > this->PatchVersionIntroduced) - { + { return false; - } + } return (tweakV < this->TweakVersionIntroduced); } @@ -609,9 +609,9 @@ cmPolicies::~cmPolicies() std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i = this->Policies.begin(); for (;i != this->Policies.end(); ++i) - { + { delete i->second; - } + } } void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, @@ -626,11 +626,11 @@ void cmPolicies::DefinePolicy(cmPolicies::PolicyID iD, { // a policy must be unique and can only be defined once if (this->Policies.find(iD) != this->Policies.end()) - { + { cmSystemTools::Error("Attempt to redefine a CMake policy for policy " "ID ", this->GetPolicyIDString(iD).c_str()); return; - } + } this->Policies[iD] = new cmPolicy(iD, idString, shortDescription, @@ -784,15 +784,15 @@ bool cmPolicies::GetPolicyDefault(cmMakefile* mf, std::string const& policy, bool cmPolicies::GetPolicyID(const char *id, cmPolicies::PolicyID &pid) { if (!id || strlen(id) < 1) - { + { return false; - } + } std::map<std::string,cmPolicies::PolicyID>::iterator pos = this->PolicyStringMap.find(id); if (pos == this->PolicyStringMap.end()) - { + { return false; - } + } pid = pos->second; return true; } @@ -802,9 +802,9 @@ std::string cmPolicies::GetPolicyIDString(cmPolicies::PolicyID pid) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(pid); if (pos == this->Policies.end()) - { + { return ""; - } + } return pos->second->IDString; } @@ -815,11 +815,11 @@ std::string cmPolicies::GetPolicyWarning(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { cmSystemTools::Error( "Request for warning text for undefined policy!"); return "Request for warning text for undefined policy!"; - } + } cmOStringStream msg; msg << @@ -839,11 +839,11 @@ std::string cmPolicies::GetRequiredPolicyError(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { cmSystemTools::Error( "Request for error text for undefined policy!"); return "Request for error text for undefined policy!"; - } + } cmOStringStream error; error << @@ -869,10 +869,10 @@ cmPolicies::GetPolicyStatus(cmPolicies::PolicyID id) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator pos = this->Policies.find(id); if (pos == this->Policies.end()) - { + { // TODO is this right? return cmPolicies::WARN; - } + } return pos->second->Status; } @@ -883,7 +883,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v) std::map<cmPolicies::PolicyID,cmPolicy *>::iterator i = this->Policies.begin(); for (;i != this->Policies.end(); ++i) - { + { cmOStringStream full; full << i->second->LongDescription; full << "\nThis policy was introduced in CMake version "; @@ -920,7 +920,7 @@ void cmPolicies::GetDocumentation(std::vector<cmDocumentationEntry>& v) i->second->ShortDescription.c_str(), full.str().c_str()); v.push_back(e); - } + } } //---------------------------------------------------------------------------- diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 93e39ab..651e0ad 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -32,16 +32,28 @@ #include "cmQtAutomoc.h" -static bool containsQ_OBJECT(const std::string& text) +static bool requiresMocing(const std::string& text, std::string ¯oName) { // this simple check is much much faster than the regexp - if (strstr(text.c_str(), "Q_OBJECT") == NULL) + if (strstr(text.c_str(), "Q_OBJECT") == NULL + && strstr(text.c_str(), "Q_GADGET") == NULL) { return false; } cmsys::RegularExpression qObjectRegExp("[\n][ \t]*Q_OBJECT[^a-zA-Z0-9_]"); - return qObjectRegExp.find(text); + if (qObjectRegExp.find(text)) + { + macroName = "Q_OBJECT"; + return true; + } + cmsys::RegularExpression qGadgetRegExp("[\n][ \t]*Q_GADGET[^a-zA-Z0-9_]"); + if (qGadgetRegExp.find(text)) + { + macroName = "Q_GADGET"; + return true; + } + return false; } @@ -436,7 +448,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configDefines.begin(), end = configDefines.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_COMPILE_DEFINITIONS_" << it->first << + infoFile << "set(AM_MOC_COMPILE_DEFINITIONS_" << it->first << " " << it->second << ")\n"; } } @@ -446,7 +458,7 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target) it = configIncludes.begin(), end = configIncludes.end(); it != end; ++it) { - infoFile << "SET(AM_MOC_INCLUDES_" << it->first << + infoFile << "set(AM_MOC_INCLUDES_" << it->first << " " << it->second << ")\n"; } } @@ -837,7 +849,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; const std::string scannedFileBasename = cmsys::SystemTools:: GetFilenameWithoutLastExtension(absFilename); - const bool cppContainsQ_OBJECT = containsQ_OBJECT(contentsString); + std::string macroName; + const bool requiresMoc = requiresMocing(contentsString, macroName); bool dotMocIncluded = false; bool mocUnderscoreIncluded = false; std::string ownMocUnderscoreFile; @@ -908,7 +921,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, else { std::string fileToMoc = absFilename; - if ((basename != scannedFileBasename) || (cppContainsQ_OBJECT==false)) + if ((basename != scannedFileBasename) || (requiresMoc==false)) { std::string mocSubDir = extractSubDir(absPath, currentMoc); std::string headerToMoc = findMatchingHeader( @@ -917,12 +930,12 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, { // this is for KDE4 compatibility: fileToMoc = headerToMoc; - if ((cppContainsQ_OBJECT==false) &&(basename==scannedFileBasename)) + if ((requiresMoc==false) &&(basename==scannedFileBasename)) { std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " "includes the moc file \"" << currentMoc << - "\", but does not contain a Q_OBJECT macro. " - "Running moc on " + "\", but does not contain a " << macroName + << " macro. Running moc on " << "\"" << headerToMoc << "\" ! Include \"moc_" << basename << ".cpp\" for a compatiblity with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" @@ -965,13 +978,14 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, // If this is the case, the moc_foo.cpp should probably be generated from // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. - if ((dotMocIncluded == false) && (cppContainsQ_OBJECT == true)) + if ((dotMocIncluded == false) && (requiresMoc == true)) { if (mocUnderscoreIncluded == true) { // this is for KDE4 compatibility: std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not " + "include " << "\"" << scannedFileBasename << ".moc\", but instead " "includes " << "\"" << ownMocUnderscoreFile << "\". Running moc on " @@ -986,7 +1000,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, { // otherwise always error out since it will not compile: std::cerr << "AUTOMOC: error: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not " + "include " << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; ::exit(EXIT_FAILURE); @@ -1094,11 +1109,13 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, // If this is the case, the moc_foo.cpp should probably be generated from // foo.cpp instead of foo.h, because otherwise it won't build. // But warn, since this is not how it is supposed to be used. - if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString))) + std::string macroName; + if ((dotMocIncluded == false) && (requiresMocing(contentsString, + macroName))) { // otherwise always error out since it will not compile: std::cerr << "AUTOMOC: error: " << absFilename << ": The file " - << "contains a Q_OBJECT macro, but does not include " + << "contains a " << macroName << " macro, but does not include " << "\"" << scannedFileBasename << ".moc\" !\n" << std::endl; ::exit(EXIT_FAILURE); @@ -1165,7 +1182,8 @@ void cmQtAutomoc::ParseHeaders(const std::set<std::string>& absHeaders, const std::string currentMoc = "moc_" + basename + ".cpp"; const std::string contents = this->ReadAll(headerName); - if (containsQ_OBJECT(contents)) + std::string macroName; + if (requiresMocing(contents, macroName)) { //std::cout << "header contains Q_OBJECT macro"; notIncludedMocs[headerName] = currentMoc; diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index cabe98a..3b6a49b 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -185,9 +185,9 @@ void cmScriptGenerator::GenerateScriptActionsOnce(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(this->Configurations); - os << indent << "IF(" << config_test << ")\n"; + os << indent << "if(" << config_test << ")\n"; this->GenerateScriptActions(os, indent.Next()); - os << indent << "ENDIF(" << config_test << ")\n"; + os << indent << "endif(" << config_test << ")\n"; } } @@ -219,7 +219,7 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { // Generate a per-configuration block. std::string config_test = this->CreateConfigTest(config); - os << indent << (first? "IF(" : "ELSEIF(") << config_test << ")\n"; + os << indent << (first? "if(" : "elseif(") << config_test << ")\n"; this->GenerateScriptForConfig(os, config, indent.Next()); first = false; } @@ -228,10 +228,10 @@ void cmScriptGenerator::GenerateScriptActionsPerConfig(std::ostream& os, { if(this->NeedsScriptNoConfig()) { - os << indent << "ELSE()\n"; + os << indent << "else()\n"; this->GenerateScriptNoConfig(os, indent.Next()); } - os << indent << "ENDIF()\n"; + os << indent << "endif()\n"; } } } diff --git a/Source/cmSetTestsPropertiesCommand.h b/Source/cmSetTestsPropertiesCommand.h index 3a59218..f2f2611 100644 --- a/Source/cmSetTestsPropertiesCommand.h +++ b/Source/cmSetTestsPropertiesCommand.h @@ -51,7 +51,8 @@ public: " set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2" " value2)\n" "Set a property for the tests. If the property is not found, CMake " - "will report an error. The properties include:\n" + "will report an error. Generator expressions will be expanded the same " + "as supported by the test's add_test call. The properties include:\n" "WILL_FAIL: If set to true, this will invert the pass/fail flag of the" " test.\n" "PASS_REGULAR_EXPRESSION: If set, the test output will be checked " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2fe771b..10b577f 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -924,7 +924,10 @@ void cmTarget::DefineProperties(cmake *cm) "The first configuration in the list found to be provided by the " "imported target is selected. If this property is set and no matching " "configurations are available, then the imported target is considered " - "to be not found. This property is ignored for non-imported targets.", + "to be not found. This property is ignored for non-imported targets.\n" + "This property is initialized by the value of the variable " + "CMAKE_MAP_IMPORTED_CONFIG_<CONFIG> if it is set when a target is " + "created.", false /* TODO: make this chained */ ); cm->DefineProperty @@ -1661,6 +1664,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) "LIBRARY_OUTPUT_DIRECTORY_", "RUNTIME_OUTPUT_DIRECTORY_", "PDB_OUTPUT_DIRECTORY_", + "MAP_IMPORTED_CONFIG_", 0}; for(std::vector<std::string>::iterator ci = configNames.begin(); ci != configNames.end(); ++ci) @@ -2669,6 +2673,11 @@ void cmTarget::FinalizeSystemIncludeDirectories() end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmListFileBacktrace lfbt; cmGeneratorExpression ge(lfbt); @@ -3063,15 +3072,11 @@ void cmTarget::SetProperty(const char* prop, const char* value) if (strcmp(prop, "LINK_LIBRARIES") == 0) { this->Internal->LinkInterfacePropertyEntries.clear(); - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.SetProperty(prop, value, cmProperty::TARGET); this->MaybeInvalidatePropertyCache(prop); @@ -3129,15 +3134,11 @@ void cmTarget::AppendProperty(const char* prop, const char* value, } if (strcmp(prop, "LINK_LIBRARIES") == 0) { - if (cmGeneratorExpression::IsValidTargetName(value) - || cmGeneratorExpression::Find(value) != std::string::npos) - { - cmListFileBacktrace lfbt; - this->Makefile->GetBacktrace(lfbt); - cmValueWithOrigin entry(value, lfbt); - this->Internal->LinkInterfacePropertyEntries.push_back(entry); - } - // Fall through + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmValueWithOrigin entry(value, lfbt); + this->Internal->LinkInterfacePropertyEntries.push_back(entry); + return; } this->Properties.AppendProperty(prop, value, cmProperty::TARGET, asString); this->MaybeInvalidatePropertyCache(prop); @@ -3417,6 +3418,11 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config) end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3615,6 +3621,11 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -3723,6 +3734,11 @@ void cmTarget::GetCompileDefinitions(std::vector<std::string> &list, end = this->Internal->LinkInterfacePropertyEntries.end(); it != end; ++it) { + if (!cmGeneratorExpression::IsValidTargetName(it->Value) + && cmGeneratorExpression::Find(it->Value) == std::string::npos) + { + continue; + } { cmGeneratorExpression ge(lfbt); cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = @@ -4145,7 +4161,7 @@ const char *cmTarget::GetProperty(const char* prop, } else { - // Support "<CONFIG>_LOCATION" for compatiblity. + // Support "<CONFIG>_LOCATION" for compatibility. int len = static_cast<int>(strlen(prop)); if(len > 9 && strcmp(prop+len-9, "_LOCATION") == 0) { @@ -4211,6 +4227,22 @@ const char *cmTarget::GetProperty(const char* prop, } return output.c_str(); } + if(strcmp(prop,"LINK_LIBRARIES") == 0) + { + static std::string output; + output = ""; + std::string sep; + for (std::vector<cmValueWithOrigin>::const_iterator + it = this->Internal->LinkInterfacePropertyEntries.begin(), + end = this->Internal->LinkInterfacePropertyEntries.end(); + it != end; ++it) + { + output += sep; + output += it->Value; + sep = ";"; + } + return output.c_str(); + } if (strcmp(prop,"IMPORTED") == 0) { @@ -6853,7 +6885,7 @@ void checkPropertyConsistency(cmTarget *depender, cmTarget *dependee, pi != props.end(); ++pi) { if (depender->GetMakefile()->GetCMakeInstance() - ->GetIsPropertyDefined(pi->c_str(), + ->IsPropertyDefined(pi->c_str(), cmProperty::TARGET)) { cmOStringStream e; diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 42f511e..d962fb2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -39,29 +39,8 @@ cmTestGenerator void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, Indent const& indent) { - // First create the tests. + // Create the tests. this->cmScriptGenerator::GenerateScriptConfigs(os, indent); - - // Now generate the test properties. - if(this->TestGenerated) - { - cmTest* test = this->Test; - cmMakefile* mf = test->GetMakefile(); - cmLocalGenerator* lg = mf->GetLocalGenerator(); - std::ostream& fout = os; - cmPropertyMap::const_iterator pit; - cmPropertyMap* mpit = &test->GetProperties(); - if ( mpit->size() ) - { - fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; - for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) - { - fout << " " << pit->first - << " " << lg->EscapeForCMake(pit->second.GetValue()); - } - fout << ")" << std::endl; - } - } } //---------------------------------------------------------------------------- @@ -94,7 +73,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. - os << indent << "ADD_TEST(" << this->Test->GetName() << " "; + os << indent << "add_test(" << this->Test->GetName() << " "; // Get the test command line to be executed. std::vector<std::string> const& command = this->Test->GetCommand(); @@ -127,13 +106,29 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Finish the test command. os << ")\n"; + + // Output properties for the test. + cmPropertyMap& pm = this->Test->GetProperties(); + if(!pm.empty()) + { + os << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for(cmPropertyMap::const_iterator i = pm.begin(); + i != pm.end(); ++i) + { + os << " " << i->first + << " " << lg->EscapeForCMake( + ge.Parse(i->second.GetValue())->Evaluate(mf, config)); + } + os << ")" << std::endl; + } } //---------------------------------------------------------------------------- void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent const& indent) { - os << indent << "ADD_TEST(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; + os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n"; } //---------------------------------------------------------------------------- @@ -157,7 +152,7 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, std::string exe = command[0]; cmSystemTools::ConvertToUnixSlashes(exe); fout << indent; - fout << "ADD_TEST("; + fout << "add_test("; fout << this->Test->GetName() << " \"" << exe << "\""; for(std::vector<std::string>::const_iterator argit = command.begin()+1; @@ -181,4 +176,21 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, fout << "\""; } fout << ")" << std::endl; + + // Output properties for the test. + cmMakefile* mf = this->Test->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmPropertyMap& pm = this->Test->GetProperties(); + if(!pm.empty()) + { + fout << indent << "set_tests_properties(" << this->Test->GetName() + << " PROPERTIES "; + for(cmPropertyMap::const_iterator i = pm.begin(); + i != pm.end(); ++i) + { + fout << " " << i->first + << " " << lg->EscapeForCMake(i->second.GetValue()); + } + fout << ")" << std::endl; + } } diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 4fc0b13..879d4fd 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -353,13 +353,13 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, cmsys::SystemTools::ReplaceString(comment, "\n", "\n# "); file << comment << "\n\n"; - file << "SET( " << this->RunResultVariable << " \n \"" + file << "set( " << this->RunResultVariable << " \n \"" << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) << "\"\n CACHE STRING \"Result from TRY_RUN\" FORCE)\n\n"; if (out!=0) { - file << "SET( " << internalRunOutputName << " \n \"" + file << "set( " << internalRunOutputName << " \n \"" << this->Makefile->GetDefinition(internalRunOutputName.c_str()) << "\"\n CACHE STRING \"Output from TRY_RUN\" FORCE)\n\n"; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 290aff0..267ce35 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2437,11 +2437,6 @@ int cmake::ActualConfigure() { this->CacheManager->SaveCache(this->GetHomeOutputDirectory()); } - if ( !this->GraphVizFile.empty() ) - { - std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; - this->GenerateGraphViz(this->GraphVizFile.c_str()); - } if(cmSystemTools::GetErrorOccuredFlag()) { return -1; @@ -2604,6 +2599,11 @@ int cmake::Generate() return -1; } this->GlobalGenerator->Generate(); + if ( !this->GraphVizFile.empty() ) + { + std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; + this->GenerateGraphViz(this->GraphVizFile.c_str()); + } if(this->WarnUnusedCli) { this->RunCheckForUnusedVariables(); @@ -3640,13 +3640,6 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope, chained); } -bool cmake::GetIsPropertyDefined(const char *name, - cmProperty::ScopeType scope) -{ - return this->PropertyDefinitions[scope].find(name) != - this->PropertyDefinitions[scope].end(); -} - cmPropertyDefinition *cmake ::GetPropertyDefinition(const char *name, cmProperty::ScopeType scope) diff --git a/Source/cmake.h b/Source/cmake.h index a50c1ed..a3872d7 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -349,8 +349,6 @@ class cmake bool chain = false, const char *variableGroup = 0); - bool GetIsPropertyDefined(const char *name, cmProperty::ScopeType scope); - // get property definition cmPropertyDefinition *GetPropertyDefinition (const char *name, cmProperty::ScopeType scope); diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt index 927ce3f..ea5fc0b 100644 --- a/Tests/Architecture/CMakeLists.txt +++ b/Tests/Architecture/CMakeLists.txt @@ -7,8 +7,8 @@ function(test_for_xcode4 result_var) execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE ov RESULT_VARIABLE rv ) - if("${rv}" STREQUAL "0") - if(ov MATCHES "^Xcode 4.[0-9].*$") + if("${rv}" STREQUAL "0" AND ov MATCHES "^Xcode ([0-9]+)\\.") + if(NOT CMAKE_MATCH_1 VERSION_LESS 4) set(${result_var} 1 PARENT_SCOPE) endif() endif() diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 3af0fda..0687154 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -285,6 +285,8 @@ if(EXISTS "${link_depends_no_shared_check_txt}") file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1) if("${link_depends_no_shared_check}" STREQUAL "0") message(STATUS "link_depends_no_shared_exe is older than link_depends_no_shared_lib as expected.") + elseif(XCODE AND NOT XCODE_VERSION VERSION_LESS 5) + message(STATUS "Known limitation: link_depends_no_shared_exe is newer than link_depends_no_shared_lib but we cannot stop Xcode ${XCODE_VERSION} from enforcing this dependency.") else() message(SEND_ERROR "Project did not rebuild properly: link_depends_no_shared_exe is newer than link_depends_no_shared_lib.") endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index b4c6a07..8806ecd 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -7,8 +7,8 @@ function(test_for_xcode4 result_var) execute_process(COMMAND xcodebuild -version OUTPUT_VARIABLE ov RESULT_VARIABLE rv ) - if("${rv}" STREQUAL "0") - if(ov MATCHES "^Xcode 4.[0-9].*$") + if("${rv}" STREQUAL "0" AND ov MATCHES "^Xcode ([0-9]+)\\.") + if(NOT CMAKE_MATCH_1 VERSION_LESS 4) set(${result_var} 1 PARENT_SCOPE) endif() endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9c3ed59..a5ad58c 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -604,6 +604,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ${build_generator_args} --build-project GeneratorExpression --build-options -DCMAKE_BUILD_TYPE=\${CTEST_CONFIGURATION_TYPE} + --test-command ${CMAKE_CTEST_COMMAND} -C \${CTEST_CONFIGURATION_TYPE} -V ) list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/GeneratorExpression") diff --git a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt index 739593c..691728a 100644 --- a/Tests/CMakeOnly/AllFindModules/CMakeLists.txt +++ b/Tests/CMakeOnly/AllFindModules/CMakeLists.txt @@ -22,11 +22,18 @@ endmacro() set(DESIRED_QT_VERSION 4) set(NO_QT4_MODULES "Qt3" "KDE3") +# ignore everything that has it's own test in Tests/Module/ +file(GLOB OWN_TEST_MODULES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/" "${CMAKE_CURRENT_SOURCE_DIR}/../../Module/Find*") +foreach(FIND_MODULE IN LISTS OWN_TEST_MODULES) + string(REGEX REPLACE "^Find" "" _MOD_NAME "${FIND_MODULE}") + list(APPEND NO_FIND_MODULES "${_MOD_NAME}") +endforeach() + # These modules are named Find*.cmake, but are nothing that works in # find_package(). -set(NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") +list(APPEND NO_FIND_MODULES "PackageHandleStandardArgs" "PackageMessage") -foreach(FIND_MODULE ${FIND_MODULES}) +foreach(FIND_MODULE IN LISTS FIND_MODULES) string(REGEX REPLACE ".*/Find(.*)\\.cmake$" "\\1" MODULE_NAME "${FIND_MODULE}") list(FIND NO_QT4_MODULES ${MODULE_NAME} NO_QT4_INDEX) diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 344b772..4c49c6a 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -55,6 +55,15 @@ set(GetPrerequisites_PreArgs ) AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") +if(GIT_EXECUTABLE) + set(PolicyCheck_PreArgs + "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}" + "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" + "-DGIT_EXECUTABLE:STRING=${GIT_EXECUTABLE}" + ) + AddCMakeTest(PolicyCheck "${PolicyCheck_PreArgs}") +endif() + # Run CheckSourceTree as the very last test in the CMake/CTest/CPack test # suite. It detects if any changes have been made to the CMake source tree # by any previous configure, build or test steps. diff --git a/Tests/CMakeTests/PolicyCheckTest.cmake.in b/Tests/CMakeTests/PolicyCheckTest.cmake.in new file mode 100644 index 0000000..416dc0a --- /dev/null +++ b/Tests/CMakeTests/PolicyCheckTest.cmake.in @@ -0,0 +1,154 @@ +# Check the CMake source tree for suspicious policy introdcutions... +# +message("=============================================================================") +message("CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message("") +message("CMake_BINARY_DIR='${CMake_BINARY_DIR}'") +message("CMake_SOURCE_DIR='${CMake_SOURCE_DIR}'") +message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") +message("") + + +# If this does not appear to be a git checkout, just pass the test here +# and now. (Do not let the test fail if it is run in a tree *exported* from a +# repository or unpacked from a .zip file source installer...) +# +set(is_git_checkout 0) +if(EXISTS "${CMake_SOURCE_DIR}/.git") + set(is_git_checkout 1) +endif() + +message("is_git_checkout='${is_git_checkout}'") +message("") + +if(NOT is_git_checkout) + message("source tree is not a git checkout... test passes by early return...") + return() +endif() + +# If no GIT_EXECUTABLE, see if we can figure out which git was used +# for the ctest_update step on this dashboard... +# +if(is_git_checkout AND NOT GIT_EXECUTABLE) + set(ctest_ini_file "") + set(exe "") + + # Use the old name: + if(EXISTS "${CMake_BINARY_DIR}/DartConfiguration.tcl") + set(ctest_ini_file "${CMake_BINARY_DIR}/DartConfiguration.tcl") + endif() + + # But if it exists, prefer the new name: + if(EXISTS "${CMake_BINARY_DIR}/CTestConfiguration.ini") + set(ctest_ini_file "${CMake_BINARY_DIR}/CTestConfiguration.ini") + endif() + + # If there is a ctest ini file, read the update command or git command + # from it: + # + if(ctest_ini_file) + file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$") + string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + set(exe "${line}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'") + endif() + + if(NOT exe) + file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$") + string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + set(exe "${line}") + if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND") + set(exe "") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'") + endif() + endif() + else() + message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...") + endif() + + # If we have still not grokked the exe, look in the Update.xml file to see + # if we can parse it from there... + # + if(NOT exe) + file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml") + if(update_xml_file) + file(STRINGS "${update_xml_file}" line + REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1) + string(REPLACE ""\;" "\"" line "${line}") + string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}") + if("${line}" MATCHES "^\"") + string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}") + else() + string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}") + endif() + if(line) + set(exe "${line}") + endif() + if(exe) + message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'") + endif() + else() + message("info: no Update.xml file...") + endif() + endif() + + if(exe) + set(GIT_EXECUTABLE "${exe}") + message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'") + message("") + + if(NOT EXISTS "${GIT_EXECUTABLE}") + message(FATAL_ERROR "GIT_EXECUTABLE does not exist...") + endif() + else() + message(FATAL_ERROR "could not determine GIT_EXECUTABLE...") + endif() +endif() + + +if(is_git_checkout AND GIT_EXECUTABLE) + # Check with "git grep" if there are any unacceptable cmPolicies additions + # + message("=============================================================================") + message("This is a git checkout, using git grep to verify no unacceptable policies") + message("are being introduced....") + message("") + + execute_process(COMMAND ${GIT_EXECUTABLE} grep -En "[0-9][0-9][0-9][0-9][0-9].*cmPolicies" + WORKING_DIRECTORY ${CMake_SOURCE_DIR} + OUTPUT_VARIABLE grep_output + OUTPUT_STRIP_TRAILING_WHITESPACE) + message("=== output of 'git grep -En \"[0-9][0-9][0-9][0-9][0-9].*cmPolicies\"' ===") + message("${grep_output}") + message("=== end output ===") + message("") + + if(NOT "${grep_output}" STREQUAL "") + message(FATAL_ERROR "git grep output is non-empty... +New CMake policies must be introduced in a non-date-based version number. +Send email to the cmake-developers list to figure out what the target +version number for this policy should be...") + endif() +endif() + + +# Still here? Good then... +# +message("test passes") +message("") diff --git a/Tests/CTestTestMemcheck/CMakeLists.txt b/Tests/CTestTestMemcheck/CMakeLists.txt index 86d7385..b5162c9 100644 --- a/Tests/CTestTestMemcheck/CMakeLists.txt +++ b/Tests/CTestTestMemcheck/CMakeLists.txt @@ -35,14 +35,31 @@ target_link_libraries(memcheck_fail CMakeLib) # same filenames. add_subdirectory(NoLogDummyChecker) -if (APPLE) - # filter out additional messages by Guard Malloc integrated in Xcode - set(GUARD_MALLOC_MSG "(ctest\([0-9]+\) malloc: [^\n]*\n)*") - set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n${GUARD_MALLOC_MSG}\n${GUARD_MALLOC_MSG}100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \n${GUARD_MALLOC_MSG}Memory checking results:\n${GUARD_MALLOC_MSG}") -else () - set(NORMAL_CTEST_OUTPUT "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n.*\n-- Processing memory checking output: \nMemory checking results:\n") -endif () -set(BULLSEYE_MSG "(BullseyeCoverage[^\n]*\n)?") +if(APPLE) + # filter out additional messages by Guard Malloc integrated in Xcode + set(guard_malloc_msg "ctest\\([0-9]+\\) malloc: ") + set(guard_malloc_lines "(${guard_malloc_msg}[^\n]*\n)*") + set(guard_malloc_output "${guard_malloc_msg}|") +else() + set(guard_malloc_msg "") + set(guard_malloc_lines "") + set(guard_malloc_output "") +endif() + +# When this entire test runs under coverage or memcheck tools +# they may add output to the end, so match known cases: +# - Bullseye adds a "BullseyeCoverage..." line. +# - Valgrind memcheck may add extra "==..." lines. +set(other_tool_output "((${guard_malloc_output}BullseyeCoverage|==)[^\n]*\n)*") + +string(REPLACE "\r\n" "\n" ctest_and_tool_outputs " +1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+\\.[0-9]+ sec +${guard_malloc_lines} +100% tests passed, 0 tests failed out of 1 +.* +-- Processing memory checking output:( ) +${guard_malloc_lines}Memory checking results: +${other_tool_output}") function(gen_mc_test_internal NAME CHECKER) set(SUBTEST_NAME "${NAME}") @@ -146,7 +163,7 @@ set_tests_properties(CTestTestMemcheckDummyValgrind CTestTestMemcheckDummyValgrindPrePost CTestTestMemcheckDummyPurify PROPERTIES - PASS_REGULAR_EXPRESSION "${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") + PASS_REGULAR_EXPRESSION "${ctest_and_tool_outputs}$") foreach (_pp Pre Post) string(TOLOWER ${_pp} _pp_lower) @@ -157,7 +174,7 @@ endforeach () set_tests_properties(CTestTestMemcheckDummyValgrindIgnoreMemcheck PROPERTIES - PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${NORMAL_CTEST_OUTPUT}${BULLSEYE_MSG}$") + PASS_REGULAR_EXPRESSION "\n2/2 Test #2: RunCMakeAgain .*${ctest_and_tool_outputs}$") set_tests_properties(CTestTestMemcheckDummyBC PROPERTIES PASS_REGULAR_EXPRESSION "\n1/1 MemCheck #1: RunCMake \\.+ Passed +[0-9]+.[0-9]+ sec\n\n100% tests passed, 0 tests failed out of 1\n(.*\n)?Error parsing XML in stream at line 1: no element found\n") diff --git a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt b/Tests/Contracts/Trilinos/CMakeLists.txt index 79ed669..f5757b5 100644 --- a/Tests/Contracts/Trilinos-10-6/CMakeLists.txt +++ b/Tests/Contracts/Trilinos/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8) -project(Trilinos-10-6) +project(Trilinos) include(ExternalProject) @@ -27,12 +27,12 @@ endif() message(STATUS "HOME='${HOME}'") if(NOT DEFINED url) - set(url "http://www.cmake.org/files/contracts/trilinos-10.6.1.tar.gz") + set(url "http://www.cmake.org/files/contracts/trilinos-11.4.1.tar.gz") endif() message(STATUS "url='${url}'") if(NOT DEFINED md5) - set(md5 "690230465dd21a76e3c6636fd07bd2f0") + set(md5 "28b6a3c7c0fb317b3a237997293faa8b") endif() message(STATUS "md5='${md5}'") diff --git a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in b/Tests/Contracts/Trilinos/Dashboard.cmake.in index cc29502..93d4f61 100644 --- a/Tests/Contracts/Trilinos-10-6/Dashboard.cmake.in +++ b/Tests/Contracts/Trilinos/Dashboard.cmake.in @@ -14,7 +14,7 @@ set(ENV{CTEST_SITE} "${CTEST_SITE}") # Allow override of the environment on a per-client basis: # -set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_10_6_ENV_SCRIPT}") +set(ENV_SCRIPT "$ENV{CMAKE_CONTRACT_Trilinos_ENV_SCRIPT}") if(ENV_SCRIPT AND EXISTS "${ENV_SCRIPT}") include("${ENV_SCRIPT}") endif() @@ -49,7 +49,7 @@ endif() # execute_process(COMMAND "${CMAKE_CTEST_COMMAND}" - -S "${CTEST_SOURCE_DIRECTORY}/cmake/ctest/experimental_build_test.cmake" + -S "${CTEST_SOURCE_DIRECTORY}/cmake/tribits/ctest/experimental_build_test.cmake" -VV WORKING_DIRECTORY "${CTEST_BINARY_DIRECTORY}" RESULT_VARIABLE rv diff --git a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake b/Tests/Contracts/Trilinos/EnvScript.cmake index dacb704..dacb704 100644 --- a/Tests/Contracts/Trilinos-10-6/EnvScript.cmake +++ b/Tests/Contracts/Trilinos/EnvScript.cmake diff --git a/Tests/Contracts/Trilinos-10-6/Patch.cmake b/Tests/Contracts/Trilinos/Patch.cmake index 6c619ac..6c619ac 100644 --- a/Tests/Contracts/Trilinos-10-6/Patch.cmake +++ b/Tests/Contracts/Trilinos/Patch.cmake diff --git a/Tests/Contracts/Trilinos-10-6/RunTest.cmake b/Tests/Contracts/Trilinos/RunTest.cmake index 30124d8..d661a4c 100644 --- a/Tests/Contracts/Trilinos-10-6/RunTest.cmake +++ b/Tests/Contracts/Trilinos/RunTest.cmake @@ -4,4 +4,4 @@ set(dir "${CMAKE_CURRENT_BINARY_DIR}/Contracts/${project}") set(exe "${CMAKE_COMMAND}") set(args -P "${dir}/ValidateBuild.cmake") -set(Trilinos-10-6_RUN_TEST ${exe} ${args}) +set(Trilinos_RUN_TEST ${exe} ${args}) diff --git a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in index 04bbf21..fa38ada 100644 --- a/Tests/Contracts/Trilinos-10-6/ValidateBuild.cmake.in +++ b/Tests/Contracts/Trilinos/ValidateBuild.cmake.in @@ -20,10 +20,10 @@ message(STATUS "Found len='${len}' *.exe files") # Try to find the Teuchos unit tests executable: # -file(GLOB_RECURSE exe "${binary_dir}/Teuchos_UnitTest_UnitTests.exe") +file(GLOB_RECURSE exe "${binary_dir}/TeuchosCore_UnitTest_UnitTests.exe") list(LENGTH exe len) if(NOT len EQUAL 1) - message(FATAL_ERROR "len='${len}' is not the expected='1' (count of Teuchos_UnitTest_UnitTests.exe)") + message(FATAL_ERROR "len='${len}' is not the expected='1' (count of TeuchosCore_UnitTest_UnitTests.exe)") endif() message(STATUS "Found exe='${exe}'") @@ -31,7 +31,7 @@ message(STATUS "Found exe='${exe}'") # Try to run it: execute_process(COMMAND ${exe} RESULT_VARIABLE rv) if(NOT "${rv}" STREQUAL "0") - message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running Teuchos_UnitTest_UnitTests.exe)") + message(FATAL_ERROR "rv='${rv}' is not the expected='0' (result of running TeuchosCore_UnitTest_UnitTests.exe)") endif() message(STATUS "Ran exe='${exe}' rv='${rv}'") diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt index 06238a4..f225ce1 100644 --- a/Tests/ExportImport/Export/CMakeLists.txt +++ b/Tests/ExportImport/Export/CMakeLists.txt @@ -159,7 +159,7 @@ set_property(TARGET testLibRequired APPEND PROPERTY $<BUILD_INTERFACE:$<TARGET_PROPERTY:testLibIncludeRequired5,INTERFACE_INCLUDE_DIRECTORIES>> # Test that the below is non-fatal $<$<STREQUAL:one,two>:$<TARGET_PROPERTY:not_a_target,INTERFACE_INCLUDE_DIRECTORIES>> - $<INSTALL_INTERFACE:include/testLibIncludeRequired7> + $<INSTALL_INTERFACE:include/testLibIncludeRequired7;include/testLibIncludeRequired4> ) set_property(TARGET testLibRequired APPEND PROPERTY diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index 4d8d7ed..e0df8c2 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required (VERSION 2.8.8) -project(GeneratorExpression CXX) +project(GeneratorExpression) + +include(CTest) # This test is split into multiple parts as needed to avoid NMake command # length limits. @@ -186,7 +188,40 @@ add_custom_target(check-part3 ALL -Dtest_alias_target_name=$<STREQUAL:$<TARGET_PROPERTY:Alias::SomeLib,NAME>,$<TARGET_PROPERTY:empty1,NAME>> -Dtest_early_termination_1=$<$<1:>: -Dtest_early_termination_2=$<$<1:>:, + -Dsystem_name=${CMAKE_HOST_SYSTEM_NAME} + -Dtest_platform_id=$<PLATFORM_ID> + -Dtest_platform_id_Linux=$<PLATFORM_ID:Linux> + -Dtest_platform_id_Windows=$<PLATFORM_ID:Windows> + -Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin> -P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)" VERBATIM ) + +#----------------------------------------------------------------------------- +# Cover test properties with generator expressions. +add_executable(echo echo.c) +add_executable(pwd pwd.c) + +add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>) +set_property(TEST echo-configuration PROPERTY + PASS_REGULAR_EXPRESSION "^$<CONFIGURATION>\n$") + +add_test(NAME echo-target-file COMMAND echo $<TARGET_FILE:echo>) +set_property(TEST echo-target-file PROPERTY + PASS_REGULAR_EXPRESSION "/echo${CMAKE_EXECUTABLE_SUFFIX}\n$") +set_property(TEST echo-target-file PROPERTY + REQUIRED_FILES "$<TARGET_FILE:echo>") + +add_test(NAME working-dir-arg + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/$<CONFIGURATION>" + COMMAND pwd) +set_property(TEST working-dir-arg PROPERTY + PASS_REGULAR_EXPRESSION "WorkingDirectory/$<CONFIGURATION>\n$") +foreach(c ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) + file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/WorkingDirectory/${c}") +endforeach() + +add_test(echo-old-style echo "\$<CONFIGURATION>") +set_property(TEST echo-old-style PROPERTY + PASS_REGULAR_EXPRESSION "^\\$<CONFIGURATION>\n$") diff --git a/Tests/GeneratorExpression/check-part3.cmake b/Tests/GeneratorExpression/check-part3.cmake index 74a596c..93ea487 100644 --- a/Tests/GeneratorExpression/check-part3.cmake +++ b/Tests/GeneratorExpression/check-part3.cmake @@ -26,3 +26,11 @@ check(test_alias_file_lib "1") check(test_alias_target_name "1") check(test_early_termination_1 "$<:") check(test_early_termination_2 "$<:,") +check(test_platform_id "${system_name}") +foreach(system Linux Windows Darwin) + if(system_name STREQUAL system) + check(test_platform_id_${system} 1) + else() + check(test_platform_id_${system} 0) + endif() +endforeach() diff --git a/Tests/GeneratorExpression/echo.c b/Tests/GeneratorExpression/echo.c new file mode 100644 index 0000000..06b0844 --- /dev/null +++ b/Tests/GeneratorExpression/echo.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, char* argv[]) +{ + printf("%s\n", argv[1]); + return EXIT_SUCCESS; +} diff --git a/Tests/GeneratorExpression/pwd.c b/Tests/GeneratorExpression/pwd.c new file mode 100644 index 0000000..054b1af --- /dev/null +++ b/Tests/GeneratorExpression/pwd.c @@ -0,0 +1,34 @@ +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> + +#ifdef _WIN32 +#include <direct.h> +#define getcurdir _getcwd +#else +#include <unistd.h> +#define getcurdir getcwd +#endif + +int main(int argc, char* argv[]) +{ +#define BUFSZ 20000 + char buf[BUFSZ + 1]; +#ifdef _WIN32 + char *pos; +#endif + getcurdir(buf, BUFSZ); +#ifdef _WIN32 + pos = buf; + while (*pos) + { + if (*pos == '\\') + { + *pos = '/'; + } + ++pos; + } +#endif + printf("%s\n", buf); + return EXIT_SUCCESS; +} diff --git a/Tests/MakeClean/ToClean/CMakeLists.txt b/Tests/MakeClean/ToClean/CMakeLists.txt index 28569dd..37d7292 100644 --- a/Tests/MakeClean/ToClean/CMakeLists.txt +++ b/Tests/MakeClean/ToClean/CMakeLists.txt @@ -26,6 +26,18 @@ add_custom_command(OUTPUT ${ToClean_BINARY_DIR}/generated.txt add_custom_target(generate ALL DEPENDS ${ToClean_BINARY_DIR}/generated.txt) set(TOCLEAN_FILES ${TOCLEAN_FILES} "${ToClean_BINARY_DIR}/generated.txt") +# Create a custom command whose output should be cleaned, but whose name +# is not known until generate-time +set(copied_exe "$<TARGET_FILE_DIR:toclean>/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}") +add_custom_command(TARGET toclean POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy $<TARGET_FILE:toclean> + ${copied_exe} + ) +set_property(DIRECTORY APPEND PROPERTY + ADDITIONAL_MAKE_CLEAN_FILES ${copied_exe}) +list(APPEND TOCLEAN_FILES "${ToClean_BINARY_DIR}/toclean_copy${CMAKE_EXECUTABLE_SUFFIX}") + # Configure a file listing these build-time-generated files. configure_file(${ToClean_SOURCE_DIR}/ToCleanFiles.cmake.in ${ToClean_BINARY_DIR}/ToCleanFiles.cmake @ONLY IMMEDIATE) diff --git a/Tests/QtAutomoc/CMakeLists.txt b/Tests/QtAutomoc/CMakeLists.txt index 69e52ac..8ad693a 100644 --- a/Tests/QtAutomoc/CMakeLists.txt +++ b/Tests/QtAutomoc/CMakeLists.txt @@ -41,7 +41,7 @@ add_library(codeeditorLib STATIC codeeditor.cpp) add_library(privateSlot OBJECT private_slot.cpp) add_executable(foo main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp - xyz.cpp yaf.cpp $<TARGET_OBJECTS:privateSlot>) + xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>) set_target_properties(foo codeeditorLib privateSlot PROPERTIES AUTOMOC TRUE) diff --git a/Tests/QtAutomoc/gadget.cpp b/Tests/QtAutomoc/gadget.cpp new file mode 100644 index 0000000..23d95fa --- /dev/null +++ b/Tests/QtAutomoc/gadget.cpp @@ -0,0 +1,4 @@ + +#include "gadget.h" + +#include "moc_gadget.cpp" diff --git a/Tests/QtAutomoc/gadget.h b/Tests/QtAutomoc/gadget.h new file mode 100644 index 0000000..7c688ee --- /dev/null +++ b/Tests/QtAutomoc/gadget.h @@ -0,0 +1,18 @@ + +#ifndef GADGET_H +#define GADGET_H + +#include <QObject> + +class Gadget +{ + Q_GADGET + Q_ENUMS(Type) +public: + enum Type { + Type0, + Type1 + }; +}; + +#endif diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index 00faa4c..f770c93 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -52,6 +52,7 @@ function(run_cmake test) set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n") endif() foreach(o out err) + string(REGEX REPLACE "(^|\n)(==[0-9]+==[^\n]*\n)+" "\\1" actual_std${o} "${actual_std${o}}") string(REGEX REPLACE "\n+$" "" actual_std${o} "${actual_std${o}}") set(expect_${o} "") if(DEFINED expect_std${o}) diff --git a/Tests/RunCMake/include_directories/RunCMakeTest.cmake b/Tests/RunCMake/include_directories/RunCMakeTest.cmake index f0704f4..f66823e 100644 --- a/Tests/RunCMake/include_directories/RunCMakeTest.cmake +++ b/Tests/RunCMake/include_directories/RunCMakeTest.cmake @@ -10,3 +10,4 @@ run_cmake(ImportedTarget) run_cmake(RelativePathInGenex) run_cmake(CMP0021) run_cmake(install_config) +run_cmake(incomplete-genex) diff --git a/Tests/RunCMake/include_directories/incomplete-genex.cmake b/Tests/RunCMake/include_directories/incomplete-genex.cmake new file mode 100644 index 0000000..b6900a4 --- /dev/null +++ b/Tests/RunCMake/include_directories/incomplete-genex.cmake @@ -0,0 +1,23 @@ +project(incomplete-genex) + +cmake_policy(SET CMP0022 NEW) +cmake_policy(SET CMP0023 NEW) + +add_library(somelib empty.cpp) + +# This test ensures that some internal mechanisms of cmGeneratorExpression +# do not segfault (#14410). + +# Test that cmGeneratorExpression::Preprocess(StripAllGeneratorExpressions) +# does not segfault +target_include_directories(somelib PUBLIC + "/include;/include/$<BUILD_INTERFACE:subdir" +) + +# Test that cmGeneratorExpression::Preprocess(BuildInterface) does not segfault +export(TARGETS somelib FILE somelibTargets.cmake) + +install(TARGETS somelib EXPORT someExport DESTINATION prefix) +# Test that cmGeneratorExpression::Preprocess(InstallInterface) +# and cmGeneratorExpression::Split do not segfault +install(EXPORT someExport DESTINATION prefix) @@ -692,7 +692,10 @@ if ${cmake_system_linux}; then # avoid binutils problem with large binaries, e.g. when building CMake in debug mode # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230 if ${cmake_machine_parisc}; then - cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*" + # if -O[s23] is given the effect is inverted, so do not use the flag then + if [ "`echo "${CXXFLAGS}" | sed -r '/^(.* )?(-O[s234])( .*)?$/s/.*/-Os/'`" != "-Os" ]; then + cmake_ld_flags="${LDFLAGS} -Wl,--unique=.text.*" + fi fi fi |