summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CTestCustom.cmake.in1
-rw-r--r--Docs/cmake-help.vim21
-rw-r--r--Modules/BundleUtilities.cmake42
-rw-r--r--Modules/CMakeASM_NASMInformation.cmake46
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake1
-rw-r--r--Modules/CMakeDetermineASM_NASMCompiler.cmake27
-rw-r--r--Modules/CMakeDetermineCompilerABI.cmake3
-rw-r--r--Modules/CMakeDetermineFortranCompiler.cmake3
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake6
-rw-r--r--Modules/CMakeFortranInformation.cmake42
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake7
-rw-r--r--Modules/CMakePlatformId.h.in2
-rw-r--r--Modules/CMakeTestASM-ATTCompiler.cmake8
-rw-r--r--Modules/CMakeTestASMCompiler.cmake9
-rw-r--r--Modules/CMakeTestASM_MASMCompiler.cmake8
-rw-r--r--Modules/CMakeTestASM_NASMCompiler.cmake23
-rwxr-xr-xModules/CPack.STGZ_Header.sh.in2
-rw-r--r--Modules/CPackRPM.cmake42
-rw-r--r--Modules/Compiler/NAG-Fortran.cmake32
-rw-r--r--Modules/ExternalProject.cmake60
-rw-r--r--Modules/FindBoost.cmake54
-rw-r--r--Modules/FindBullet.cmake5
-rw-r--r--Modules/FindCxxTest.cmake7
-rw-r--r--Modules/FindFLEX.cmake4
-rw-r--r--Modules/FindITK.cmake78
-rw-r--r--Modules/FindQt3.cmake6
-rw-r--r--Modules/FindTCL.cmake4
-rw-r--r--Modules/FortranCInterface/CMakeLists.txt2
-rw-r--r--Modules/Platform/Darwin-NAG-Fortran.cmake5
-rw-r--r--Modules/Platform/Darwin.cmake8
-rw-r--r--Modules/Platform/Linux-NAG-Fortran.cmake10
-rw-r--r--Modules/Platform/Windows-cl.cmake2
-rw-r--r--Modules/Qt4ConfigDependentSettings.cmake23
-rw-r--r--Modules/Qt4Macros.cmake8
-rw-r--r--Source/CMakeLists.txt6
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx101
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.h4
-rw-r--r--Source/CPack/cmCPackGenerator.cxx103
-rw-r--r--Source/CPack/cmCPackGenerator.h28
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx77
-rw-r--r--Source/CPack/cmCPackRPMGenerator.h1
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx6
-rw-r--r--Source/CTest/cmCTestSleepCommand.h9
-rw-r--r--Source/cmAddDependenciesCommand.cxx6
-rw-r--r--Source/cmAddDependenciesCommand.h2
-rw-r--r--Source/cmCacheManager.cxx19
-rw-r--r--Source/cmCacheManager.h4
-rw-r--r--Source/cmComputeLinkInformation.cxx2
-rw-r--r--Source/cmComputeTargetDepends.cxx69
-rw-r--r--Source/cmComputeTargetDepends.h4
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx87
-rw-r--r--Source/cmExtraCodeBlocksGenerator.h9
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx95
-rw-r--r--Source/cmExtraEclipseCDT4Generator.h9
-rw-r--r--Source/cmFindBase.cxx30
-rw-r--r--Source/cmFindBase.h4
-rw-r--r--Source/cmFindCommon.cxx4
-rw-r--r--Source/cmFindCommon.h2
-rw-r--r--Source/cmFindFileCommand.cxx9
-rw-r--r--Source/cmFindFileCommand.h2
-rw-r--r--Source/cmFindLibraryCommand.cxx15
-rw-r--r--Source/cmFindLibraryCommand.h1
-rw-r--r--Source/cmFindPackageCommand.cxx24
-rw-r--r--Source/cmFindPackageCommand.h2
-rw-r--r--Source/cmFindPathCommand.cxx25
-rw-r--r--Source/cmFindPathCommand.h4
-rw-r--r--Source/cmFindProgramCommand.cxx11
-rw-r--r--Source/cmFindProgramCommand.h2
-rw-r--r--Source/cmGlobalGenerator.cxx27
-rw-r--r--Source/cmGlobalGenerator.h51
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx123
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h37
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx14
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h10
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.cxx49
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h3
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx85
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h1
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx22
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h3
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx204
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h25
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx12
-rw-r--r--Source/cmGraphVizWriter.cxx435
-rw-r--r--Source/cmGraphVizWriter.h84
-rw-r--r--Source/cmLoadCacheCommand.cxx38
-rw-r--r--Source/cmLoadCacheCommand.h1
-rw-r--r--Source/cmLocalGenerator.cxx32
-rw-r--r--Source/cmLocalGenerator.h6
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx82
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx10
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx16
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmMakefileTargetGenerator.cxx2
-rw-r--r--Source/cmStringCommand.cxx2
-rw-r--r--Source/cmTarget.cxx56
-rw-r--r--Source/cmTargetDepend.h48
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx19
-rw-r--r--Source/cmVisualStudioGeneratorOptions.cxx51
-rw-r--r--Source/cmVisualStudioGeneratorOptions.h5
-rw-r--r--Source/cmake.cxx392
-rw-r--r--Source/cmake.h76
-rw-r--r--Source/kwsys/CMakeLists.txt5
-rw-r--r--Source/kwsys/SystemTools.cxx6
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake4
-rw-r--r--Source/kwsys/testSystemTools.cxx2
-rw-r--r--Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in9
-rw-r--r--Tests/CustomCommand/CMakeLists.txt5
-rw-r--r--Tests/ExportImport/Import/A/CMakeLists.txt56
-rw-r--r--Tests/ExportImport/Import/A/imp_lib1.c2
-rw-r--r--Tests/StringFileTest/CMakeLists.txt24
-rw-r--r--Tests/VSExternalInclude/CMakeLists.txt8
114 files changed, 2321 insertions, 1208 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index d5789ed..882fa4c 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -24,6 +24,7 @@ SET(CTEST_CUSTOM_WARNING_EXCEPTION
"is not used for resolving any symbol"
"Clock skew detected"
"remark\\(1209"
+ "remark: .*LOOP WAS VECTORIZED"
"LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF"
"LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
"Warning: library was too large for page size.*"
diff --git a/Docs/cmake-help.vim b/Docs/cmake-help.vim
new file mode 100644
index 0000000..17cfa83
--- /dev/null
+++ b/Docs/cmake-help.vim
@@ -0,0 +1,21 @@
+nmap ,hc :call OpenCmakeHelp()<CR>
+
+function! OpenCmakeHelp()
+ let s = getline( '.' )
+ let i = col( '.' ) - 1
+ while i > 0 && strpart( s, i, 1 ) =~ '[A-Za-z0-9_]'
+ let i = i - 1
+ endwhile
+ while i < col('$') && strpart( s, i, 1 ) !~ '[A-Za-z0-9_]'
+ let i = i + 1
+ endwhile
+ let start = match( s, '[A-Za-z0-9_]\+', i )
+ let end = matchend( s, '[A-Za-z0-9_]\+', i )
+ let ident = strpart( s, start, end - start )
+ execute "vertical new"
+ execute "%!cmake --help-command ".ident
+ set nomodified
+ set readonly
+endfunction
+
+autocmd BufRead,BufNewFile *.cmake,CMakeLists.txt,*.cmake.in nmap <F1> :call OpenCmakeHelp()<CR>
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index c7ead5b..44f2c20 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -27,6 +27,11 @@
# drag-n-drop copied to another machine and run on that machine as long as all
# of the system libraries are compatible.
#
+# If you pass plugins to fixup_bundle as the libs parameter, you should install
+# them or copy them into the bundle before calling fixup_bundle. The "libs"
+# parameter is a list of libraries that must be fixed up, but that cannot be
+# determined by otool output analysis. (i.e., plugins)
+#
# Gather all the keys for all the executables and libraries in a bundle, and
# then, for each key, copy each prerequisite into the bundle. Then fix each one
# up according to its own list of prerequisites.
@@ -112,6 +117,13 @@
# _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to
# an "@executable_path" style reference.)
#
+# This function requires that the resolved_embedded_item be "inside" the bundle
+# already. In other words, if you pass plugins to fixup_bundle as the libs
+# parameter, you should install them or copy them into the bundle before
+# calling fixup_bundle. The "libs" parameter is a list of libraries that must
+# be fixed up, but that cannot be determined by otool output analysis. (i.e.,
+# plugins)
+#
# Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM
# value.
#
@@ -472,11 +484,11 @@ function(copy_resolved_item_into_bundle resolved_item resolved_embedded_item)
else()
#message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy ${resolved_item} ${resolved_embedded_item}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
+ if(UNIX AND NOT APPLE)
+ file(RPATH_REMOVE FILE "${resolved_embedded_item}")
+ endif(UNIX AND NOT APPLE)
endif()
- if(UNIX AND NOT APPLE)
- file(RPATH_REMOVE FILE "${resolved_embedded_item}")
- endif(UNIX AND NOT APPLE)
endfunction(copy_resolved_item_into_bundle)
@@ -514,11 +526,11 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}")
endif()
endif()
+ if(UNIX AND NOT APPLE)
+ file(RPATH_REMOVE FILE "${resolved_embedded_item}")
+ endif(UNIX AND NOT APPLE)
endif()
- if(UNIX AND NOT APPLE)
- file(RPATH_REMOVE FILE "${resolved_embedded_item}")
- endif(UNIX AND NOT APPLE)
endfunction(copy_resolved_framework_into_bundle)
@@ -527,6 +539,24 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
#
get_item_key("${resolved_embedded_item}" ikey)
+ # Ensure the item is "inside the .app bundle" -- it should not be fixed up if
+ # it is not in the .app bundle... Otherwise, we'll modify files in the build
+ # tree, or in other varied locations around the file system, with our call to
+ # install_name_tool. Make sure that doesn't happen here:
+ #
+ get_dotapp_dir("${exepath}" exe_dotapp_dir)
+ string(LENGTH "${exe_dotapp_dir}/" exe_dotapp_dir_length)
+ string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring)
+ if(NOT "${exe_dotapp_dir}/" STREQUAL "${item_substring}")
+ message(" exe_dotapp_dir/='${exe_dotapp_dir}/'")
+ message(" item_substring='${item_substring}'")
+ message(" resolved_embedded_item='${resolved_embedded_item}'")
+ message("")
+ message("Install or copy the item into the bundle before calling fixup_bundle")
+ message("")
+ message(FATAL_ERROR "cannot fixup an item that is not in the bundle...")
+ endif()
+
set(prereqs "")
get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}")
diff --git a/Modules/CMakeASM_NASMInformation.cmake b/Modules/CMakeASM_NASMInformation.cmake
new file mode 100644
index 0000000..9da7d30
--- /dev/null
+++ b/Modules/CMakeASM_NASMInformation.cmake
@@ -0,0 +1,46 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# support for the nasm assembler
+
+set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS nasm asm)
+
+if(NOT CMAKE_ASM_NASM_OBJECT_FORMAT)
+ if(WIN32)
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT win64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT win32)
+ endif()
+ elseif(APPLE)
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT macho)
+ endif()
+ else()
+ if(CMAKE_C_SIZEOF_DATA_PTR EQUAL 8)
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
+ else()
+ SET(CMAKE_ASM_NASM_OBJECT_FORMAT elf)
+ endif()
+ endif()
+endif()
+
+set(CMAKE_ASM_NASM_COMPILE_OBJECT "<CMAKE_ASM_NASM_COMPILER> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")
+
+# Load the generic ASMInformation file:
+set(ASM_DIALECT "_NASM")
+include(CMakeASMInformation)
+set(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index 06dd6b8..8353be4 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -65,6 +65,7 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler")
+ INCLUDE(CMakeDetermineCompilerId)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
diff --git a/Modules/CMakeDetermineASM_NASMCompiler.cmake b/Modules/CMakeDetermineASM_NASMCompiler.cmake
new file mode 100644
index 0000000..d184c0a
--- /dev/null
+++ b/Modules/CMakeDetermineASM_NASMCompiler.cmake
@@ -0,0 +1,27 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# Find the nasm assembler. yasm (http://www.tortall.net/projects/yasm/) is nasm compatible
+
+SET(CMAKE_ASM_NASM_COMPILER_INIT nasm yasm)
+
+IF(NOT CMAKE_ASM_NASM_COMPILER)
+ FIND_PROGRAM(CMAKE_ASM_NASM_COMPILER nasm
+ "$ENV{ProgramFiles}/NASM")
+ENDIF(NOT CMAKE_ASM_NASM_COMPILER)
+
+# Load the generic DetermineASM compiler file with the DIALECT set properly:
+SET(ASM_DIALECT "_NASM")
+INCLUDE(CMakeDetermineASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index d6df305..ed0b6fb 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -64,7 +64,8 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
AND NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";"
# Skip this with Xcode for now.
AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode)
- CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log)
+ CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log
+ "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Parsed ${lang} implicit link information from above output:\n${log}\n\n")
ENDIF()
diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake
index 03ddd78..3801d7d 100644
--- a/Modules/CMakeDetermineFortranCompiler.cmake
+++ b/Modules/CMakeDetermineFortranCompiler.cmake
@@ -169,6 +169,9 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN)
LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq)
SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what")
SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran")
+ LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS NAG) # Numerical Algorithms Group
+ SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_NAG "-V")
+ SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_NAG "NAG Fortran Compiler")
# Try to identify the compiler.
SET(CMAKE_Fortran_COMPILER_ID)
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index 836e4c9..fbcdc98 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -17,6 +17,12 @@
FIND_PROGRAM(CMAKE_ECLIPSE_EXECUTABLE NAMES eclipse DOC "The Eclipse executable")
+# This variable is used by the Eclipse generator and appended to the make invocation commands.
+SET(CMAKE_ECLIPSE_MAKE_ARGUMENTS "" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
+
+# This variable is used by the Eclipse generator in out-of-source builds only.
+SET(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
+MARK_AS_ADVANCED(ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT)
# The Eclipse generator needs to know the standard include path
# so that Eclipse ca find the headers at runtime and parsing etc. works better
diff --git a/Modules/CMakeFortranInformation.cmake b/Modules/CMakeFortranInformation.cmake
index f6a52c6..1e9b4e0 100644
--- a/Modules/CMakeFortranInformation.cmake
+++ b/Modules/CMakeFortranInformation.cmake
@@ -67,29 +67,29 @@ SET(CMAKE_NEEDS_REQUIRES_STEP_Fortran_FLAG 1)
# Create a set of shared library variable specific to Fortran
# For 90% of the systems, these are the same flags as the C versions
# so if these are not set just copy the flags from the c version
-IF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS)
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS)
SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS)
+ENDIF()
-IF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS)
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_Fortran_FLAGS)
SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_LIBRARY_Fortran_FLAGS)
+ENDIF()
IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS ${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS})
-ENDIF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS)
+ENDIF()
-IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG)
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
-ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG)
+ENDIF()
-IF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP)
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP)
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
-ENDIF(NOT CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP)
+ENDIF()
-IF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG)
+IF(NOT DEFINED CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG)
SET(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG})
-ENDIF(NOT CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG)
+ENDIF()
IF(NOT DEFINED CMAKE_EXE_EXPORTS_Fortran_FLAG)
SET(CMAKE_EXE_EXPORTS_Fortran_FLAG ${CMAKE_EXE_EXPORTS_C_FLAG})
@@ -100,25 +100,25 @@ IF(NOT DEFINED CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG)
ENDIF()
# repeat for modules
-IF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
+IF(NOT DEFINED CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
SET(CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_CREATE_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_MODULE_CREATE_Fortran_FLAGS)
+ENDIF()
-IF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS)
+IF(NOT DEFINED CMAKE_SHARED_MODULE_Fortran_FLAGS)
SET(CMAKE_SHARED_MODULE_Fortran_FLAGS ${CMAKE_SHARED_MODULE_C_FLAGS})
-ENDIF(NOT CMAKE_SHARED_MODULE_Fortran_FLAGS)
+ENDIF()
-IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG)
+IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG)
SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG})
-ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG)
+ENDIF()
-IF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP)
+IF(NOT DEFINED CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP)
SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP})
-ENDIF(NOT CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG_SEP)
+ENDIF()
-IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG)
+IF(NOT DEFINED CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG)
SET(CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG})
-ENDIF(NOT CMAKE_EXECUTABLE_RPATH_LINK_Fortran_FLAG)
+ENDIF()
IF(NOT DEFINED CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH)
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_WITH_RUNTIME_PATH ${CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH})
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index defdb47..5405bda 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -16,7 +16,7 @@
# This is used internally by CMake and should not be included by user
# code.
-function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var)
+function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
set(implicit_libs_tmp "")
set(implicit_dirs_tmp)
set(log "")
@@ -59,6 +59,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var)
# Unix library full path.
list(APPEND implicit_libs_tmp ${arg})
set(log "${log} arg [${arg}] ==> lib [${arg}]\n")
+ elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$"
+ AND obj_regex AND "${arg}" MATCHES "${obj_regex}")
+ # Object file full path.
+ list(APPEND implicit_libs_tmp ${arg})
+ set(log "${log} arg [${arg}] ==> obj [${arg}]\n")
elseif("${arg}" MATCHES "^-Y(P,)?")
# Sun search path.
string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}")
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index e20348a..1c63cca 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -83,7 +83,7 @@
#endif
/* For windows compilers MSVC and Intel we can determine
- the architecture of the compiler being used. This is becase
+ the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
diff --git a/Modules/CMakeTestASM-ATTCompiler.cmake b/Modules/CMakeTestASM-ATTCompiler.cmake
index 3b7a74f..581ad0c 100644
--- a/Modules/CMakeTestASM-ATTCompiler.cmake
+++ b/Modules/CMakeTestASM-ATTCompiler.cmake
@@ -13,10 +13,10 @@
# License text for the above reference.)
# This file is used by EnableLanguage in cmGlobalGenerator to
-# determine that that selected ASM-ATT compiler can actually compile
-# and link the most basic of programs. If not, a fatal error
-# is set and cmake stops processing commands and will not generate
-# any makefiles or projects.
+# determine that the selected ASM-ATT "compiler" works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
SET(ASM_DIALECT "-ATT")
INCLUDE(CMakeTestASMCompiler)
diff --git a/Modules/CMakeTestASMCompiler.cmake b/Modules/CMakeTestASMCompiler.cmake
index 54def81..56cf332 100644
--- a/Modules/CMakeTestASMCompiler.cmake
+++ b/Modules/CMakeTestASMCompiler.cmake
@@ -13,10 +13,11 @@
# License text for the above reference.)
# This file is used by EnableLanguage in cmGlobalGenerator to
-# determine that that selected ASM compiler can actually compile
-# and link the most basic of programs. If not, a fatal error
-# is set and cmake stops processing commands and will not generate
-# any makefiles or projects.
+# determine that the selected ASM compiler works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
IF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_WORKS 1 CACHE INTERNAL "")
ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER)
diff --git a/Modules/CMakeTestASM_MASMCompiler.cmake b/Modules/CMakeTestASM_MASMCompiler.cmake
index 84ca98f..8369b94 100644
--- a/Modules/CMakeTestASM_MASMCompiler.cmake
+++ b/Modules/CMakeTestASM_MASMCompiler.cmake
@@ -13,10 +13,10 @@
# License text for the above reference.)
# This file is used by EnableLanguage in cmGlobalGenerator to
-# determine that the selected ASM_MASM "compiler" (should be masm or masm64)
-# can actually "compile" and link the most basic of programs. If not, a
-# fatal error is set and cmake stops processing commands and will not generate
-# any makefiles or projects.
+# determine that the selected ASM_MASM "compiler" (should be masm or masm64)
+# works. For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
SET(ASM_DIALECT "_MASM")
INCLUDE(CMakeTestASMCompiler)
diff --git a/Modules/CMakeTestASM_NASMCompiler.cmake b/Modules/CMakeTestASM_NASMCompiler.cmake
new file mode 100644
index 0000000..a5e2bea
--- /dev/null
+++ b/Modules/CMakeTestASM_NASMCompiler.cmake
@@ -0,0 +1,23 @@
+
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that the selected ASM_NASM "compiler" works.
+# For assembler this can only check whether the compiler has been found,
+# because otherwise there would have to be a separate assembler source file
+# for each assembler on every architecture.
+
+SET(ASM_DIALECT "_NASM")
+INCLUDE(CMakeTestASMCompiler)
+SET(ASM_DIALECT)
diff --git a/Modules/CPack.STGZ_Header.sh.in b/Modules/CPack.STGZ_Header.sh.in
index 3b50e74..dee576f 100755
--- a/Modules/CPack.STGZ_Header.sh.in
+++ b/Modules/CPack.STGZ_Header.sh.in
@@ -80,7 +80,7 @@ then
if [ "x${cpack_skip_license}x" != "xTRUEx" ]
then
- more << ____cpack__here_doc____
+ more << '____cpack__here_doc____'
@CPACK_RESOURCE_FILE_LICENSE_CONTENT@
____cpack__here_doc____
echo
diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake
index e2d78802..026c45a 100644
--- a/Modules/CPackRPM.cmake
+++ b/Modules/CPackRPM.cmake
@@ -331,7 +331,7 @@ ELSE(CPACK_RPM_COMPRESSION_TYPE)
ENDIF(CPACK_RPM_COMPRESSION_TYPE)
if(CPACK_PACKAGE_RELOCATABLE)
- set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
+ set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE)
endif(CPACK_PACKAGE_RELOCATABLE)
if(CPACK_RPM_PACKAGE_RELOCATABLE)
if(CPACK_RPM_PACKAGE_DEBUG)
@@ -453,6 +453,17 @@ SET(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}")
#STRING(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
+
+# Are we packaging components ?
+IF(CPACK_RPM_PACKAGE_COMPONENT)
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
+ELSE(CPACK_RPM_PACKAGE_COMPONENT)
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
+ SET(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
+ SET(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
+ENDIF(CPACK_RPM_PACKAGE_COMPONENT)
# Use files tree to construct files command (spec file)
# We should not forget to include symlinks (thus -o -type l)
# We must remove the './' due to the local search and escape the
@@ -460,10 +471,10 @@ SET(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}")
# Then we must authorize any man pages extension (adding * at the end)
# because rpmbuild may automatically compress those files
EXECUTE_PROCESS(COMMAND find -type f -o -type l
- COMMAND sed {s:.*/man.*/.*:&*:}
- COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/}
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
- OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
+ COMMAND sed {s:.*/man.*/.*:&*:}
+ COMMAND sed {s/\\.\\\(.*\\\)/\"\\1\"/}
+ WORKING_DIRECTORY "${WDIR}"
+ OUTPUT_VARIABLE CPACK_RPM_INSTALL_FILES)
if (CPACK_ABSOLUTE_DESTINATION_FILES)
IF(CPACK_RPM_PACKAGE_DEBUG)
@@ -494,7 +505,7 @@ if (CPACK_ABSOLUTE_DESTINATION_FILES)
endif(CPACK_ABSOLUTE_DESTINATION_FILES)
# The name of the final spec file to be used by rpmbuild
-SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
+SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.spec")
# Print out some debug information if we were asked for that
IF(CPACK_RPM_PACKAGE_DEBUG)
@@ -517,7 +528,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
"# -*- rpm-spec -*-
-BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
+BuildRoot: \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@
Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@
Name: \@CPACK_RPM_PACKAGE_NAME\@
Version: \@CPACK_RPM_PACKAGE_VERSION\@
@@ -555,10 +566,9 @@ mv $RPM_BUILD_ROOT \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\"
%install
if [ -e $RPM_BUILD_ROOT ];
then
- mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/*\" $RPM_BUILD_ROOT
-else
- mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
+ rm -rf $RPM_BUILD_ROOT
fi
+mv \"\@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot\" $RPM_BUILD_ROOT
%clean
@@ -608,15 +618,15 @@ IF(RPMBUILD_EXECUTABLE)
# Now call rpmbuild using the SPECFILE
EXECUTE_PROCESS(
COMMAND "${RPMBUILD_EXECUTABLE}" -bb
- --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
+ --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
"${CPACK_RPM_BINARY_SPECFILE}"
- WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
- ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err"
- OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")
+ WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}"
+ ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err"
+ OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out")
IF(CPACK_RPM_PACKAGE_DEBUG)
MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ")
- MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err")
- MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")
+ MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.err")
+ MESSAGE("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_COMPONENT_PART_NAME}.out")
ENDIF(CPACK_RPM_PACKAGE_DEBUG)
ELSE(RPMBUILD_EXECUTABLE)
IF(ALIEN_EXECUTABLE)
diff --git a/Modules/Compiler/NAG-Fortran.cmake b/Modules/Compiler/NAG-Fortran.cmake
new file mode 100644
index 0000000..b68c479
--- /dev/null
+++ b/Modules/Compiler/NAG-Fortran.cmake
@@ -0,0 +1,32 @@
+# Help CMAKE_PARSE_IMPLICIT_LINK_INFO detect NAG Fortran object files.
+if(NOT CMAKE_Fortran_COMPILER_WORKS AND NOT CMAKE_Fortran_COMPILER_FORCED)
+ message(STATUS "Detecting NAG Fortran directory")
+ # Run with -dryrun to see sample "link" line.
+ execute_process(
+ COMMAND ${CMAKE_Fortran_COMPILER} dummy.o -dryrun
+ OUTPUT_VARIABLE _dryrun
+ ERROR_VARIABLE _dryrun
+ )
+ # Match an object file.
+ string(REGEX MATCH "/[^ ]*/[^ /][^ /]*\\.o" _nag_obj "${_dryrun}")
+ if(_nag_obj)
+ # Parse object directory and convert to a regex.
+ string(REGEX REPLACE "/[^/]*$" "" _nag_dir "${_nag_obj}")
+ string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _nag_regex "${_nag_dir}")
+ set(CMAKE_Fortran_IMPLICIT_OBJECT_REGEX "^${_nag_regex}/")
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Detecting NAG Fortran directory with -dryrun found\n"
+ " object: ${_nag_obj}\n"
+ " directory: ${_nag_dir}\n"
+ " regex: ${CMAKE_Fortran_IMPLICIT_OBJECT_REGEX}\n"
+ "from output:\n${_dryrun}\n\n")
+ message(STATUS "Detecting NAG Fortran directory - ${_nag_dir}")
+ else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Detecting NAG Fortran directory with -dryrun failed:\n${_dryrun}\n\n")
+ message(STATUS "Detecting NAG Fortran directory - failed")
+ endif()
+endif()
+
+set(CMAKE_Fortran_MODDIR_FLAG "-mdir ")
+set(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-PIC")
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 997164a..a3590cf 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -32,6 +32,7 @@
# [CMAKE_COMMAND /.../cmake] # Specify alternative cmake executable
# [CMAKE_GENERATOR gen] # Specify generator for native build
# [CMAKE_ARGS args...] # Arguments to CMake command line
+# [CMAKE_CACHE_ARGS args...] # Initial cache arguments, of the form -Dvar:string=on
# #--Build step-----------------
# [BINARY_DIR dir] # Specify build dir location
# [BUILD_COMMAND cmd...] # Command to drive the native build
@@ -549,6 +550,47 @@ function(_ep_set_directories name)
endforeach()
endfunction(_ep_set_directories)
+function(_ep_write_initial_cache script_filename args)
+ # Write out values into an initial cache, that will be passed to CMake with -C
+ set(script_initial_cache "")
+ set(regex "^([^:]+):([^=]+)=(.*)$")
+ set(setArg "")
+ foreach(line ${args})
+ if("${line}" MATCHES "^-D")
+ if(setArg)
+ # This is required to build up lists in variables, or complete an entry
+ set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+ set(script_initial_cache "${script_initial_cache}\n${setArg}")
+ set(accumulator "")
+ set(setArg "")
+ endif()
+ string(REGEX REPLACE "^-D" "" line ${line})
+ if("${line}" MATCHES "${regex}")
+ string(REGEX MATCH "${regex}" match "${line}")
+ set(name "${CMAKE_MATCH_1}")
+ set(type "${CMAKE_MATCH_2}")
+ set(value "${CMAKE_MATCH_3}")
+ set(setArg "set(${name} \"${value}")
+ else()
+ message(WARNING "Line '${line}' does not match regex. Ignoring.")
+ endif()
+ else()
+ # Assume this is a list to append to the last var
+ set(accumulator "${accumulator};${line}")
+ endif()
+ endforeach()
+ # Catch the final line of the args
+ if(setArg)
+ set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" FORCE)")
+ set(script_initial_cache "${script_initial_cache}\n${setArg}")
+ endif()
+ # Write out the initial cache file to the location specified.
+ if(NOT EXISTS "${script_filename}.in")
+ file(WRITE "${script_filename}.in" "\@script_initial_cache\@\n")
+ endif()
+ configure_file("${script_filename}.in" "${script_filename}")
+endfunction(_ep_write_initial_cache)
+
function(ExternalProject_Get_Property name)
foreach(var ${ARGN})
@@ -1224,11 +1266,24 @@ function(_ep_add_configure_command name)
get_property(cmake_args TARGET ${name} PROPERTY _EP_CMAKE_ARGS)
list(APPEND cmd ${cmake_args})
+ # If there are any CMAKE_CACHE_ARGS, write an initial cache and use it
+ get_property(cmake_cache_args TARGET ${name} PROPERTY _EP_CMAKE_CACHE_ARGS)
+ if(cmake_cache_args)
+ set(_ep_cache_args_script "${tmp_dir}/${name}-cache.cmake")
+ _ep_write_initial_cache("${_ep_cache_args_script}" "${cmake_cache_args}")
+ list(APPEND cmd "-C${_ep_cache_args_script}")
+ endif()
+
get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
if(cmake_generator)
list(APPEND cmd "-G${cmake_generator}" "${source_dir}")
else()
- list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}")
+ if(CMAKE_EXTRA_GENERATOR)
+ list(APPEND cmd "-G${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}"
+ "${source_dir}")
+ else()
+ list(APPEND cmd "-G${CMAKE_GENERATOR}" "${source_dir}")
+ endif()
endif()
endif()
@@ -1237,10 +1292,11 @@ function(_ep_add_configure_command name)
# Fixes issue http://public.kitware.com/Bug/view.php?id=10258
#
if(NOT EXISTS ${tmp_dir}/${name}-cfgcmd.txt.in)
- file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='@cmd@'\n")
+ file(WRITE ${tmp_dir}/${name}-cfgcmd.txt.in "cmd='\@cmd\@'\n")
endif()
configure_file(${tmp_dir}/${name}-cfgcmd.txt.in ${tmp_dir}/${name}-cfgcmd.txt)
list(APPEND file_deps ${tmp_dir}/${name}-cfgcmd.txt)
+ list(APPEND file_deps ${_ep_cache_args_script})
get_property(log TARGET ${name} PROPERTY _EP_LOG_CONFIGURE)
if(log)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 28296f1..8930405 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -64,7 +64,8 @@
# Currently this module searches for the following version numbers:
# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
-# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0
+# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0,
+# 1.45, 1.45.0, 1.46, 1.46.0
#
# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
# add both 1.x and 1.x.0 as shown above. Official Boost include directories
@@ -377,7 +378,7 @@ else(Boost_FIND_VERSION_EXACT)
# The user has not requested an exact version. Among known
# versions, find those that are acceptable to the user request.
set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
- "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
+ "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42"
"1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37"
"1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0"
"1.34" "1.33.1" "1.33.0" "1.33")
@@ -412,9 +413,7 @@ IF(Boost_INCLUDE_DIR)
# On versions < 1.35, remove the System library from the considered list
# since it wasn't added until 1.35.
if(Boost_VERSION AND Boost_FIND_COMPONENTS)
- math(EXPR _boost_maj "${Boost_VERSION} / 100000")
- math(EXPR _boost_min "${Boost_VERSION} / 100 % 1000")
- if(${_boost_maj}.${_boost_min} VERSION_LESS 1.35)
+ if(Boost_VERSION LESS 103500)
list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
endif()
endif()
@@ -477,16 +476,16 @@ ELSE (_boost_IN_CACHE)
# BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
# linked dynamically. Alternatively you can force all Boost
# libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
-
+
# This feature can be disabled for Boost library "whatever" by
# defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
# BOOST_ALL_NO_LIB.
-
+
# If you want to observe which libraries are being linked against
# then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
# code to emit a #pragma message each time a library is selected
# for linking.
- SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS
+ SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS
"-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
ENDIF(WIN32)
@@ -519,12 +518,12 @@ ELSE (_boost_IN_CACHE)
IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
-
+
# If BOOST_LIBRARYDIR was defined in the environment, use it.
IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
-
+
IF( BOOST_ROOT )
file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
ENDIF( BOOST_ROOT )
@@ -563,7 +562,7 @@ ELSE (_boost_IN_CACHE)
endif( BOOST_INCLUDEDIR )
# ------------------------------------------------------------------------
- # Search for Boost include DIR
+ # Search for Boost include DIR
# ------------------------------------------------------------------------
# Try to find Boost by stepping backwards through the Boost versions
# we know about.
@@ -578,18 +577,18 @@ ELSE (_boost_IN_CACHE)
# Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
IF(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
- STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
+ STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
_boost_BOOSTIFIED_VERSION ${_boost_VER})
ELSEIF(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
- STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
+ STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
_boost_BOOSTIFIED_VERSION ${_boost_VER})
ENDIF()
-
+
list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
ENDFOREACH(_boost_VER)
-
+
if(Boost_DEBUG)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"Include debugging info:")
@@ -607,7 +606,7 @@ ELSE (_boost_IN_CACHE)
${_boost_FIND_OPTIONS}
)
ENDIF( NOT Boost_INCLUDE_DIR )
-
+
# ------------------------------------------------------------------------
# Extract version information from version.hpp
# ------------------------------------------------------------------------
@@ -623,13 +622,13 @@ ELSE (_boost_IN_CACHE)
message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
"location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
endif()
-
+
STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
-
+
SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
-
+
IF(NOT "${Boost_VERSION}" STREQUAL "0")
MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
@@ -647,7 +646,7 @@ ELSE (_boost_IN_CACHE)
set(Boost_ERROR_REASON
"${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
ENDIF(Boost_INCLUDE_DIR)
-
+
# ------------------------------------------------------------------------
# Suffix initialization and compiler suffix detection.
# ------------------------------------------------------------------------
@@ -670,7 +669,7 @@ ELSE (_boost_IN_CACHE)
# please report them and use the Boost_COMPILER variable
# to work around the problems.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
- OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
+ OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
if(WIN32)
set (_boost_COMPILER "-iw")
@@ -999,7 +998,7 @@ ELSE (_boost_IN_CACHE)
if (NOT Boost_FIND_VERSION_PATCH)
set(Boost_FIND_VERSION_PATCH 0)
endif (NOT Boost_FIND_VERSION_PATCH)
-
+
# We'll set Boost_FOUND true again if we have an exact version match.
set(Boost_FOUND FALSE)
_Boost_MARK_COMPONENTS_FOUND(OFF)
@@ -1018,7 +1017,7 @@ ELSE (_boost_IN_CACHE)
set(Boost_ERROR_REASON
"${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
if (Boost_FIND_VERSION_PATCH)
- set(Boost_ERROR_REASON
+ set(Boost_ERROR_REASON
"${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
endif (Boost_FIND_VERSION_PATCH)
if (NOT Boost_FIND_VERSION_EXACT)
@@ -1073,16 +1072,16 @@ ELSE (_boost_IN_CACHE)
# Note that the user may not have installed any libraries
# so it is quite possible the Boost_LIBRARY_PATH may not exist.
SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
-
+
IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
-
+
IF("${_boost_LIB_DIR}" MATCHES "/include$")
# Strip off the trailing "/include" in the path.
GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
-
+
IF(EXISTS "${_boost_LIB_DIR}/lib")
SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
ELSE(EXISTS "${_boost_LIB_DIR}/lib")
@@ -1092,7 +1091,7 @@ ELSE (_boost_IN_CACHE)
SET(_boost_LIB_DIR "")
ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
-
+
IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
@@ -1143,4 +1142,3 @@ ELSE (_boost_IN_CACHE)
Boost_LIBRARY_DIRS
)
ENDIF(_boost_IN_CACHE)
-
diff --git a/Modules/FindBullet.cmake b/Modules/FindBullet.cmake
index 50c8527..ea0abb7 100644
--- a/Modules/FindBullet.cmake
+++ b/Modules/FindBullet.cmake
@@ -31,7 +31,7 @@ macro(_FIND_BULLET_LIBRARY _var)
find_library(${_var}
NAMES
${ARGN}
- PATHS
+ HINTS
${BULLET_ROOT}
${BULLET_ROOT}/out/release8/libs
${BULLET_ROOT}/out/debug8/libs
@@ -50,9 +50,10 @@ macro(_BULLET_APPEND_LIBRARIES _list _release)
endmacro()
find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
- PATHS
+ HINTS
${BULLET_ROOT}/include
${BULLET_ROOT}/src
+ PATH_SUFFIXES bullet
)
# Find the libraries
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 4ff6eba..912a157 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -97,6 +97,11 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# Version 1.4 (11/18/10) (CMake 2.8.4)
+# Issue 11384: Added support to the CXX_ADD_TEST macro so header
+# files (containing the tests themselves) show up in
+# Visual Studio and other IDEs.
+#
# Version 1.3 (8/19/10) (CMake 2.8.3)
# Included patch by Simone Rossetto to check if either Python or Perl
# are present in the system. Whichever intepreter that is detected
@@ -131,7 +136,7 @@ macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
)
set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
- add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname})
+ add_executable(${_cxxtest_testname} ${_cxxtest_real_outfname} ${ARGN})
if(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
add_test(${_cxxtest_testname} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_cxxtest_testname})
diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake
index 272cdc7..ff6b085 100644
--- a/Modules/FindFLEX.cmake
+++ b/Modules/FindFLEX.cmake
@@ -36,8 +36,8 @@
# find_package(BISON)
# find_package(FLEX)
#
-# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp
-# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BIANRY_DIR}/lexer.cpp)
+# BISON_TARGET(MyParser parser.y ${CMAKE_CURRENT_BINARY_DIR}/parser.cpp)
+# FLEX_TARGET(MyScanner lexer.l ${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp)
# ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
#
# include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake
index 244ce54..5f43dd9 100644
--- a/Modules/FindITK.cmake
+++ b/Modules/FindITK.cmake
@@ -21,7 +21,7 @@
# instead.
#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2010 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -33,67 +33,23 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-SET(ITK_DIR_STRING "directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.")
+# Use the Config mode of the find_package() command to find ITKConfig.
+# If this succeeds (possibly because ITK_DIR is already set), the
+# command will have already loaded ITKConfig.cmake and set ITK_FOUND.
+IF(NOT ITK_FOUND)
+ FIND_PACKAGE(ITK QUIET NO_MODULE
+ NAMES ITK InsightToolkit
+ CONFIGS ITKConfig.cmake
+ )
+ENDIF()
-# Search only if the location is not already known.
-IF(NOT ITK_DIR)
- # Get the system search path as a list.
- IF(UNIX)
- STRING(REGEX MATCHALL "[^:]+" ITK_DIR_SEARCH1 "$ENV{PATH}")
- ELSE(UNIX)
- STRING(REGEX REPLACE "\\\\" "/" ITK_DIR_SEARCH1 "$ENV{PATH}")
- ENDIF(UNIX)
- STRING(REGEX REPLACE "/;" ";" ITK_DIR_SEARCH2 ${ITK_DIR_SEARCH1})
-
- # Construct a set of paths relative to the system search path.
- SET(ITK_DIR_SEARCH "")
- FOREACH(dir ${ITK_DIR_SEARCH2})
- SET(ITK_DIR_SEARCH ${ITK_DIR_SEARCH} "${dir}/../lib/InsightToolkit")
- ENDFOREACH(dir)
-
- #
- # Look for an installation or build tree.
- #
- FIND_PATH(ITK_DIR ITKConfig.cmake
- # Look for an environment variable ITK_DIR.
- $ENV{ITK_DIR}
-
- # Look in places relative to the system executable search path.
- ${ITK_DIR_SEARCH}
-
- # Look in standard UNIX install locations.
- /usr/local/lib/InsightToolkit
- /usr/lib/InsightToolkit
-
- # Read from the CMakeSetup registry entries. It is likely that
- # ITK will have been recently built.
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
- [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
- # Help the user find it if we cannot.
- DOC "The ${ITK_DIR_STRING}"
- )
-ENDIF(NOT ITK_DIR)
-
-# If ITK was found, load the configuration file to get the rest of the
-# settings.
-IF(ITK_DIR)
- SET(ITK_FOUND 1)
- INCLUDE(${ITK_DIR}/ITKConfig.cmake)
+SET(ITK_DIR_MESSAGE "Please set ITK_DIR to the directory containing ITKConfig.cmake. This is either the root of the build tree, or PREFIX/lib/InsightToolkit for an installation.")
+IF(ITK_FOUND)
# Set USE_ITK_FILE for backward-compatability.
SET(USE_ITK_FILE ${ITK_USE_FILE})
-ELSE(ITK_DIR)
- SET(ITK_FOUND 0)
- IF(ITK_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Please set ITK_DIR to the ${ITK_DIR_STRING}")
- ENDIF(ITK_FIND_REQUIRED)
-ENDIF(ITK_DIR)
+ELSEIF(ITK_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR ${ITK_DIR_MESSAGE})
+ELSEIF(NOT ITK_FIND_QUIETLY)
+ MESSAGE(STATUS ${ITK_DIR_MESSAGE})
+ENDIF()
diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake
index 3606a5f..1319de2 100644
--- a/Modules/FindQt3.cmake
+++ b/Modules/FindQt3.cmake
@@ -242,9 +242,9 @@ IF (QT_MIN_VERSION)
ENDIF (QT_MIN_VERSION)
# if the include a library are found then we have it
-IF(QT_INCLUDE_DIR AND QT_QT_LIBRARY)
- SET( QT_FOUND "YES" )
-ENDIF(QT_INCLUDE_DIR AND QT_QT_LIBRARY)
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Qt3 DEFAULT_MSG QT_QT_LIBRARY QT_INCLUDE_DIR QT_MOC_EXECUTABLE)
+SET(QT_FOUND ${QT3_FOUND} )
IF(QT_FOUND)
SET( QT_LIBRARIES ${QT_LIBRARIES} ${QT_QT_LIBRARY} )
diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake
index 8d780c1..8cfd9ca 100644
--- a/Modules/FindTCL.cmake
+++ b/Modules/FindTCL.cmake
@@ -104,7 +104,7 @@ ENDIF(WIN32)
FIND_LIBRARY(TCL_LIBRARY
NAMES
tcl
- tcl${TK_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
+ tcl${TCL_LIBRARY_VERSION} tcl${TCL_TCLSH_VERSION} tcl${TK_WISH_VERSION}
tcl86 tcl8.6
tcl85 tcl8.5
tcl84 tcl8.4
@@ -117,7 +117,7 @@ FIND_LIBRARY(TCL_LIBRARY
FIND_LIBRARY(TK_LIBRARY
NAMES
tk
- tk${TCL_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
+ tk${TK_LIBRARY_VERSION} tk${TCL_TCLSH_VERSION} tk${TK_WISH_VERSION}
tk86 tk8.6
tk85 tk8.5
tk84 tk8.4
diff --git a/Modules/FortranCInterface/CMakeLists.txt b/Modules/FortranCInterface/CMakeLists.txt
index 18014af..4bcaae9 100644
--- a/Modules/FortranCInterface/CMakeLists.txt
+++ b/Modules/FortranCInterface/CMakeLists.txt
@@ -45,10 +45,12 @@ set(module_symbols
my_module_mp_my_sub_ # Intel
MY_MODULE_mp_MY_SUB # Intel on Windows
my_module_my_sub_ # PGI
+ my_module_MP_my_sub # NAG
mymodule$mysub # HP
mymodule_mp_mysub_ # Intel
MYMODULE_mp_MYSUB # Intel on Windows
mymodule_mysub_ # PGI
+ mymodule_MP_mysub # NAG
${FortranCInterface_MODULE_SYMBOLS}
)
list(REMOVE_DUPLICATES module_symbols)
diff --git a/Modules/Platform/Darwin-NAG-Fortran.cmake b/Modules/Platform/Darwin-NAG-Fortran.cmake
new file mode 100644
index 0000000..933f9e1
--- /dev/null
+++ b/Modules/Platform/Darwin-NAG-Fortran.cmake
@@ -0,0 +1,5 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
+
+# Need -fpp explicitly on case-insensitive filesystem.
+set(CMAKE_Fortran_COMPILE_OBJECT
+ "<CMAKE_Fortran_COMPILER> -fpp -o <OBJECT> <DEFINES> <FLAGS> -c <SOURCE>")
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index db0642e..a99ff4a 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -33,8 +33,8 @@ SET(CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
SET(CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
SET(CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
-SET(CMAKE_C_LINK_FLAGS "-headerpad_max_install_names")
-SET(CMAKE_CXX_LINK_FLAGS "-headerpad_max_install_names")
+SET(CMAKE_C_LINK_FLAGS "-Wl,-headerpad_max_install_names")
+SET(CMAKE_CXX_LINK_FLAGS "-Wl,-headerpad_max_install_names")
IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
@@ -42,8 +42,8 @@ IF(HAVE_FLAG_SEARCH_PATHS_FIRST)
ENDIF(HAVE_FLAG_SEARCH_PATHS_FIRST)
SET(CMAKE_PLATFORM_HAS_INSTALLNAME 1)
-SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
-SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
+SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
+SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -Wl,-headerpad_max_install_names")
SET(CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
SET(CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
diff --git a/Modules/Platform/Linux-NAG-Fortran.cmake b/Modules/Platform/Linux-NAG-Fortran.cmake
new file mode 100644
index 0000000..353bae6
--- /dev/null
+++ b/Modules/Platform/Linux-NAG-Fortran.cmake
@@ -0,0 +1,10 @@
+set(CMAKE_Fortran_VERBOSE_FLAG "-Wl,-v") # Runs gcc under the hood.
+
+# Need one "-Wl," level to send flag through to gcc.
+# Use "-Xlinker" to get through gcc to real linker.
+set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-Wl,-shared")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-Xlinker,-rpath,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_Fortran_FLAG "-Wl,-Xlinker,-rpath-link,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,-Xlinker,-soname,-Xlinker,")
+set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,-rdynamic")
diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake
index 7463c62..56582ff 100644
--- a/Modules/Platform/Windows-cl.cmake
+++ b/Modules/Platform/Windows-cl.cmake
@@ -212,6 +212,8 @@ SET (CMAKE_EXE_LINKER_FLAGS_INIT
SET( MSVC_INCREMENTAL_YES_FLAG "")
IF(NOT MSVC_INCREMENTAL_DEFAULT)
SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
+ELSE()
+ SET( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
ENDIF()
IF (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
diff --git a/Modules/Qt4ConfigDependentSettings.cmake b/Modules/Qt4ConfigDependentSettings.cmake
index bfb50de..10af3bc 100644
--- a/Modules/Qt4ConfigDependentSettings.cmake
+++ b/Modules/Qt4ConfigDependentSettings.cmake
@@ -35,10 +35,10 @@ SET(QT_QTHELP_LIB_DEPENDENCIES ${QT_QTCLUCENE_LIBRARY})
IF(Q_WS_WIN)
- # On Windows, qconfig.pri has "static" for static library builds
- IF(QT_CONFIG MATCHES "static")
+ # On Windows, qconfig.pri has "shared" for shared library builds
+ IF(NOT QT_CONFIG MATCHES "shared")
SET(QT_IS_STATIC 1)
- ENDIF(QT_CONFIG MATCHES "static")
+ ENDIF(NOT QT_CONFIG MATCHES "shared")
ELSE(Q_WS_WIN)
# On other platforms, check file extension to know if its static
IF(QT_QTCORE_LIBRARY_RELEASE)
@@ -75,6 +75,23 @@ IF(QT_QCONFIG MATCHES "system-png")
SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY})
ENDIF(QT_QCONFIG MATCHES "system-png")
+## system jpeg
+IF(QT_QCONFIG MATCHES "system-jpeg")
+ find_package(JPEG)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${JPEG_LIBRARIES})
+ENDIF(QT_QCONFIG MATCHES "system-jpeg")
+
+## system tiff
+IF(QT_QCONFIG MATCHES "system-tiff")
+ find_package(TIFF)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${TIFF_LIBRARIES})
+ENDIF(QT_QCONFIG MATCHES "system-tiff")
+
+## system mng
+IF(QT_QCONFIG MATCHES "system-mng")
+ find_library(MNG_LIBRARY NAMES mng)
+ SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${MNG_LIBRARY})
+ENDIF(QT_QCONFIG MATCHES "system-mng")
# for X11, get X11 library directory
IF(Q_WS_X11)
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index df07d25..6a609a0 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -71,12 +71,12 @@ MACRO (QT4_GET_MOC_FLAGS _moc_flags)
GET_DIRECTORY_PROPERTY(_inc_DIRS INCLUDE_DIRECTORIES)
FOREACH(_current ${_inc_DIRS})
- IF("${_current}" MATCHES ".framework/?$")
- STRING(REGEX REPLACE "/[^/]+.framework" "" framework_path "${_current}")
+ IF("${_current}" MATCHES "\\.framework/?$")
+ STRING(REGEX REPLACE "/[^/]+\\.framework" "" framework_path "${_current}")
SET(${_moc_flags} ${${_moc_flags}} "-F${framework_path}")
- ELSE("${_current}" MATCHES ".framework/?$")
+ ELSE("${_current}" MATCHES "\\.framework/?$")
SET(${_moc_flags} ${${_moc_flags}} "-I${_current}")
- ENDIF("${_current}" MATCHES ".framework/?$")
+ ENDIF("${_current}" MATCHES "\\.framework/?$")
ENDFOREACH(_current ${_inc_DIRS})
GET_DIRECTORY_PROPERTY(_defines COMPILE_DEFINITIONS)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 71284b2..718e52e 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -183,6 +183,8 @@ SET(SRCS
cmGlobalUnixMakefileGenerator3.cxx
cmGlobalUnixMakefileGenerator3.h
cmGraphAdjacencyList.h
+ cmGraphVizWriter.cxx
+ cmGraphVizWriter.h
cmInstallGenerator.h
cmInstallGenerator.cxx
cmInstallExportGenerator.cxx
@@ -332,7 +334,7 @@ ENDIF (WIN32)
# create a library used by the command line and the GUI
ADD_LIBRARY(CMakeLib ${SRCS})
-TARGET_LINK_LIBRARIES(CMakeLib cmsys
+TARGET_LINK_LIBRARIES(CMakeLib cmsys
${CMAKE_EXPAT_LIBRARIES} ${CMAKE_ZLIB_LIBRARIES}
${CMAKE_TAR_LIBRARIES} ${CMAKE_COMPRESS_LIBRARIES}
${CMAKE_CURL_LIBRARIES} )
@@ -432,7 +434,7 @@ IF(CYGWIN)
CPack/cmCPackCygwinSourceGenerator.cxx
)
ENDIF(CYGWIN)
-
+
IF(UNIX)
SET(CPACK_SRCS ${CPACK_SRCS}
CPack/cmCPackDebGenerator.cxx
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index c86434e..46be99b 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -105,12 +105,12 @@ if (!archive) \
}
//----------------------------------------------------------------------
-int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup)
+int cmCPackArchiveGenerator::PackageComponents(bool ignoreGroup)
{
packageFileNames.clear();
// The default behavior is to have one package by component group
// unless CPACK_COMPONENTS_IGNORE_GROUP is specified.
- if (!ignoreComponentGroup)
+ if (!ignoreGroup)
{
std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
for (compGIt=this->ComponentGroups.begin();
@@ -170,7 +170,7 @@ int cmCPackArchiveGenerator::PackageComponents(bool ignoreComponentGroup)
}
//----------------------------------------------------------------------
-int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne)
+int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponent)
{
// reset the package file names
packageFileNames.clear();
@@ -185,7 +185,7 @@ int cmCPackArchiveGenerator::PackageComponentsAllInOne(bool allComponentInOne)
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive);
// The ALL GROUP in ONE package case
- if (! allComponentInOne) {
+ if (! allComponent) {
// iterate over the component groups
std::map<std::string, cmCPackComponentGroup>::iterator compGIt;
for (compGIt=this->ComponentGroups.begin();
@@ -226,78 +226,27 @@ int cmCPackArchiveGenerator::PackageFiles()
cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
<< toplevel << std::endl);
- // The default behavior is to create 1 package by component group
- // unless the user asked to put all COMPONENTS in a single package
- bool allGroupInOne = (NULL !=
- (this->GetOption(
- "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE")));
- bool allComponentInOne = (NULL !=
- (this->GetOption(
- "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")));
- bool ignoreComponentGroup = ( NULL !=
- (this->GetOption(
- "CPACK_COMPONENTS_IGNORE_GROUPS")));
+ PrepareGroupingKind();
- std::string groupingType;
-
- // Second way to specify grouping
- if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
- groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
- }
-
- if (groupingType.length()>0)
- {
- cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
- << this->Name << "]"
- << " requested component grouping = "<< groupingType <<std::endl);
- if (groupingType == "ALL_GROUP_IN_ONE")
- {
- allGroupInOne = true;
- }
- else if (groupingType == "ALL_COMPONENT_IN_ONE")
- {
- allComponentInOne = true;
- }
- else if (groupingType == "IGNORE")
+ if (SupportsComponentInstallation()) {
+ // CASE 1 : COMPONENT ALL-IN-ONE package
+ // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested
+ // then the package file is unique and should be open here.
+ if (allComponentInOne ||
+ (allGroupInOne && (!this->ComponentGroups.empty()))
+ )
{
- ignoreComponentGroup = true;
+ return PackageComponentsAllInOne(allComponentInOne);
}
- else
+ // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one)
+ // There will be 1 package for each component group
+ // however one may require to ignore component group and
+ // in this case you'll get 1 package for each component.
+ else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup))
{
- cmCPackLogger(cmCPackLog::LOG_WARNING, "["
- << this->Name << "]"
- << " requested component grouping type <"<< groupingType
- << "> UNKNOWN not in (ALL_GROUP_IN_ONE,"
- "ALL_COMPONENT_IN_ONE,IGNORE)" <<std::endl);
+ return PackageComponents(ignoreComponentGroup);
}
- }
-
- // Some components were defined but NO group
- // force ignoreGroups
- if (this->ComponentGroups.empty() && (!this->Components.empty())
- && (!ignoreComponentGroup)) {
- cmCPackLogger(cmCPackLog::LOG_WARNING, "["
- << this->Name << "]"
- << " Some Components defined but NO component group:"
- << " Ignoring component group."
- << std::endl);
- ignoreComponentGroup = true;
}
- // CASE 1 : COMPONENT ALL-IN-ONE package
- // If ALL GROUPS or ALL COMPONENTS in ONE package has been requested
- // then the package file is unique and should be open here.
- if (allComponentInOne || (allGroupInOne && (!this->ComponentGroups.empty())))
- {
- return PackageComponentsAllInOne(allComponentInOne);
- }
- // CASE 2 : COMPONENT CLASSICAL package(s) (i.e. not all-in-one)
- // There will be 1 package for each component group
- // however one may require to ignore component group and
- // in this case you'll get 1 package for each component.
- else if ((!this->ComponentGroups.empty()) || (ignoreComponentGroup))
- {
- return PackageComponents(ignoreComponentGroup);
- }
// CASE 3 : NON COMPONENT package.
DECLARE_AND_OPEN_ARCHIVE(packageFileNames[0],archive);
@@ -333,5 +282,15 @@ int cmCPackArchiveGenerator::GenerateHeader(std::ostream*)
}
bool cmCPackArchiveGenerator::SupportsComponentInstallation() const {
- return true;
+ // The Component installation support should only
+ // be activated if explicitly requested by the user
+ // (for backward compatibility reason)
+ if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
}
diff --git a/Source/CPack/cmCPackArchiveGenerator.h b/Source/CPack/cmCPackArchiveGenerator.h
index 6e173bd..dc17257 100644
--- a/Source/CPack/cmCPackArchiveGenerator.h
+++ b/Source/CPack/cmCPackArchiveGenerator.h
@@ -60,12 +60,12 @@ protected:
* install is used. This will create one
* archive for each component group.
*/
- int PackageComponents(bool ignoreComponentGroup);
+ int PackageComponents(bool ignoreGroup);
/**
* Special case of component install where all
* components will be put in a single installer.
*/
- int PackageComponentsAllInOne(bool allComponentInOne);
+ int PackageComponentsAllInOne(bool allComponent);
virtual const char* GetOutputExtension() = 0;
cmArchiveWrite::Compress Compress;
cmArchiveWrite::Type Archive;
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index c39aea4..feda52c 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -35,6 +35,9 @@ cmCPackGenerator::cmCPackGenerator()
this->GeneratorVerbose = false;
this->MakefileMap = 0;
this->Logger = 0;
+ this->allGroupInOne = false;
+ this->allComponentInOne = false;
+ this->ignoreComponentGroup = false;
}
//----------------------------------------------------------------------
@@ -220,7 +223,7 @@ int cmCPackGenerator::InstallProject()
// If the CPackConfig file sets CPACK_INSTALLED_DIRECTORIES
// then glob it and copy it to CPACK_TEMPORARY_DIRECTORY
- // This is used in Source packageing
+ // This is used in Source packaging
if ( !this->InstallProjectViaInstalledDirectories(
setDestDir, tempInstallDirectory) )
{
@@ -548,7 +551,14 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
std::vector<std::string> componentsVector;
bool componentInstall = false;
- if (this->SupportsComponentInstallation())
+ /*
+ * We do a component install iff
+ * - the CPack generator support component
+ * - the user did not request Monolithic install
+ * (this works at CPack time too)
+ */
+ if (this->SupportsComponentInstallation() &
+ !(this->IsSet("CPACK_MONOLITHIC_INSTALL")))
{
// Determine the installation types for this project (if provided).
std::string installTypesVar = "CPACK_"
@@ -691,7 +701,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
//
// If DESTDIR has been 'internally set ON' this means that
// the underlying CPack specific generator did ask for that
- // In this case we may overrode CPACK_INSTALL_PREFIX with
+ // In this case we may override CPACK_INSTALL_PREFIX with
// CPACK_PACKAGING_INSTALL_PREFIX
// I know this is tricky and awkward but it's the price for
// CPACK_SET_DESTDIR backward compatibility.
@@ -727,7 +737,20 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
{
dir = tempInstallDirectory + "/" + dir;
}
-
+ /*
+ * We must re-set DESTDIR for each component
+ * We must not add the CPACK_INSTALL_PREFIX part because
+ * it will be added using the override of CMAKE_INSTALL_PREFIX
+ * The main reason for this awkward trick is that
+ * are using DESTDIR for 2 different reasons:
+ * - Because it was asked by the CPack Generator or the user
+ * using CPACK_SET_DESTDIR
+ * - Because it was already used for component install
+ * in order to put things in subdirs...
+ */
+ cmSystemTools::PutEnv(
+ (std::string("DESTDIR=")+tempInstallDirectory).c_str()
+ );
cmCPackLogger(cmCPackLog::LOG_DEBUG,
"- Creating directory: '" << dir << "'" << std::endl);
@@ -1047,7 +1070,13 @@ bool cmCPackGenerator::IsSet(const char* name) const
}
//----------------------------------------------------------------------
-const char* cmCPackGenerator::GetOption(const char* op)
+bool cmCPackGenerator::IsOn(const char* name) const
+{
+ return cmSystemTools::IsOn(GetOption(name));
+}
+
+//----------------------------------------------------------------------
+const char* cmCPackGenerator::GetOption(const char* op) const
{
const char* ret = this->MakefileMap->GetDefinition(op);
if(!ret)
@@ -1196,6 +1225,70 @@ int cmCPackGenerator::CleanTemporaryDirectory()
}
//----------------------------------------------------------------------
+int cmCPackGenerator::PrepareGroupingKind()
+{
+ // The default behavior is to create 1 package by component group
+ // unless the user asked to put all COMPONENTS in a single package
+ allGroupInOne = (NULL !=
+ (this->GetOption(
+ "CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE")));
+ allComponentInOne = (NULL !=
+ (this->GetOption(
+ "CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE")));
+ ignoreComponentGroup = (NULL !=
+ (this->GetOption(
+ "CPACK_COMPONENTS_IGNORE_GROUPS")));
+
+ std::string groupingType;
+
+ // Second way to specify grouping
+ if (NULL != this->GetOption("CPACK_COMPONENTS_GROUPING")) {
+ groupingType = this->GetOption("CPACK_COMPONENTS_GROUPING");
+ }
+
+ if (groupingType.length()>0)
+ {
+ cmCPackLogger(cmCPackLog::LOG_VERBOSE, "["
+ << this->Name << "]"
+ << " requested component grouping = "<< groupingType <<std::endl);
+ if (groupingType == "ALL_GROUP_IN_ONE")
+ {
+ allGroupInOne = true;
+ }
+ else if (groupingType == "ALL_COMPONENT_IN_ONE")
+ {
+ allComponentInOne = true;
+ }
+ else if (groupingType == "IGNORE")
+ {
+ ignoreComponentGroup = true;
+ }
+ else
+ {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "["
+ << this->Name << "]"
+ << " requested component grouping type <"<< groupingType
+ << "> UNKNOWN not in (ALL_GROUP_IN_ONE,"
+ "ALL_COMPONENT_IN_ONE,IGNORE)" <<std::endl);
+ }
+ }
+
+ // Some components were defined but NO group
+ // force ignoreGroups
+ if (this->ComponentGroups.empty() && (!this->Components.empty())
+ && (!ignoreComponentGroup)) {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "["
+ << this->Name << "]"
+ << " Some Components defined but NO component group:"
+ << " Ignoring component group."
+ << std::endl);
+ ignoreComponentGroup = true;
+ }
+
+ return 1;
+}
+
+//----------------------------------------------------------------------
bool cmCPackGenerator::SupportsComponentInstallation() const
{
return false;
diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h
index 74b780d..f44a334 100644
--- a/Source/CPack/cmCPackGenerator.h
+++ b/Source/CPack/cmCPackGenerator.h
@@ -88,8 +88,9 @@ public:
//! Set and get the options
void SetOption(const char* op, const char* value);
void SetOptionIfNotSet(const char* op, const char* value);
- const char* GetOption(const char* op);
+ const char* GetOption(const char* op) const;
bool IsSet(const char* name) const;
+ bool IsOn(const char* name) const;
//! Set all the variables
int SetCMakeRoot();
@@ -120,6 +121,17 @@ protected:
virtual const char* GetOutputPostfix() { return 0; }
/**
+ * Prepare requested grouping kind from CPACK_xxx vars
+ * CPACK_COMPONENTS_ALL_GROUPS_IN_ONE_PACKAGE
+ * CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE
+ * CPACK_COMPONENTS_IGNORE_GROUPS
+ * or
+ * CPACK_COMPONENTS_GROUPING
+ * @return 1 on success 0 on failure.
+ */
+ virtual int PrepareGroupingKind();
+
+ /**
* Package the list of files and/or components which
* has been prepared by the beginning of DoPackage.
* @pre @ref toplevel has been filled-in
@@ -200,6 +212,20 @@ protected:
*/
std::map<std::string, cmCPackComponent> Components;
std::map<std::string, cmCPackComponentGroup> ComponentGroups;
+ /**
+ * If true All component groups will be put in a single package.
+ */
+ bool allGroupInOne;
+ /**
+ * If true All component will be put in a single package.
+ */
+ bool allComponentInOne;
+ /**
+ * If true component grouping will be ignored.
+ * You will still get 1 package for each component unless
+ * allComponentInOne is true.
+ */
+ bool ignoreComponentGroup;
cmCPackLog* Logger;
private:
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 0641418..a5db78f 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -37,13 +37,84 @@ int cmCPackRPMGenerator::InitializeInternal()
//----------------------------------------------------------------------
int cmCPackRPMGenerator::PackageFiles()
{
- this->ReadListFile("CPackRPM.cmake");
+ int retval = 1;
+ /* Digest Component grouping specification */
+ retval = PrepareGroupingKind();
+ cmCPackLogger(cmCPackLog::LOG_DEBUG, "Toplevel: "
+ << toplevel << std::endl);
+
+ /* Are we in the component packaging case */
+ if (SupportsComponentInstallation() & (!this->ComponentGroups.empty()))
+ {
+ /* Reset package file name list it will be populated during the
+ * component packaging run*/
+ packageFileNames.clear();
+ std::string initialTopLevel(this->GetOption("CPACK_TEMPORARY_DIRECTORY"));
+ /* One Package per component CASE */
+ /* Iterate over components */
+ std::map<std::string, cmCPackComponent>::iterator compIt;
+ for (compIt=this->Components.begin();
+ compIt!=this->Components.end(); ++compIt )
+ {
+ std::string localToplevel(initialTopLevel);
+ std::string packageFileName(
+ cmSystemTools::GetParentDirectory(toplevel.c_str())
+ );
+ std::string outputFileName(
+ std::string(this->GetOption("CPACK_PACKAGE_FILE_NAME")
+ )
+ +"-"+compIt->first + this->GetOutputExtension());
+
+ localToplevel += "/"+ compIt->first;
+ /* replace the TEMP DIRECTORY with the component one */
+ this->SetOption("CPACK_TEMPORARY_DIRECTORY",localToplevel.c_str());
+ packageFileName += "/"+ outputFileName;
+ /* replace proposed CPACK_OUTPUT_FILE_NAME */
+ this->SetOption("CPACK_OUTPUT_FILE_NAME",outputFileName.c_str());
+ /* replace the TEMPORARY package file name */
+ this->SetOption("CPACK_TEMPORARY_PACKAGE_FILE_NAME",
+ packageFileName.c_str());
+
+ this->SetOption("CPACK_RPM_PACKAGE_COMPONENT",compIt->first.c_str());
+ if (!this->ReadListFile("CPackRPM.cmake"))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error while execution CPackRPM.cmake" << std::endl);
+ retval = 0;
+ }
+
+ // add the generated package to package file names list
+ packageFileNames.push_back(packageFileName);
+ }
+ }
+ /* This is the non component case */
+ else
+ {
+ if (!this->ReadListFile("CPackRPM.cmake"))
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "Error while execution CPackRPM.cmake" << std::endl);
+ retval = 0;
+ }
+ }
+
if (!this->IsSet("RPMBUILD_EXECUTABLE"))
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find rpmbuild" << std::endl);
- return 0;
+ retval = 0;
}
- return 1;
+ return retval;
}
+bool cmCPackRPMGenerator::SupportsComponentInstallation() const
+ {
+ if (IsOn("CPACK_RPM_COMPONENT_INSTALL"))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h
index 570e45f..57d5cca 100644
--- a/Source/CPack/cmCPackRPMGenerator.h
+++ b/Source/CPack/cmCPackRPMGenerator.h
@@ -39,6 +39,7 @@ protected:
virtual int InitializeInternal();
virtual int PackageFiles();
virtual const char* GetOutputExtension() { return ".rpm"; }
+ virtual bool SupportsComponentInstallation() const;
};
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 0d14c2d..93c2963 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -275,12 +275,6 @@ void cmCTestMultiProcessHandler::StartNextTests()
}
numToStart -= processors;
}
- else
- {
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl
- << "Test did not start waiting on depends to finish: "
- << *test << "\n");
- }
if(numToStart == 0)
{
return;
diff --git a/Source/CTest/cmCTestSleepCommand.h b/Source/CTest/cmCTestSleepCommand.h
index 411eb01..468cd85 100644
--- a/Source/CTest/cmCTestSleepCommand.h
+++ b/Source/CTest/cmCTestSleepCommand.h
@@ -63,11 +63,10 @@ public:
virtual const char* GetFullDocumentation()
{
return
- " ctest_sleep( seconds )\n"
- " ctest_sleep( time1 duration time2 )\n"
- "With one argument it will sleep for a given number of seconds. "
- "With three arguments it will wait for time2 - time1 - duration "
- "seconds.";
+ " ctest_sleep(<seconds>)\n"
+ "Sleep for given number of seconds.\n"
+ " ctest_sleep(<time1> <duration> <time2>)\n"
+ "Sleep for t=(time1 + duration - time2) seconds if t > 0.";
}
cmTypeMacro(cmCTestSleepCommand, cmCTestCommand);
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 1205f07..a77140d 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -24,11 +24,7 @@ bool cmAddDependenciesCommand
}
std::string target_name = args[0];
-
- cmTarget* target =
- this->GetMakefile()->GetLocalGenerator()->
- GetGlobalGenerator()->FindTarget(0, target_name.c_str());
- if(target)
+ if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
{
std::vector<std::string>::const_iterator s = args.begin();
++s; // skip over target_name
diff --git a/Source/cmAddDependenciesCommand.h b/Source/cmAddDependenciesCommand.h
index 6a981c3..fee011c 100644
--- a/Source/cmAddDependenciesCommand.h
+++ b/Source/cmAddDependenciesCommand.h
@@ -62,6 +62,8 @@ public:
"top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, "
"or ADD_CUSTOM_TARGET. Adding dependencies with this command "
"can be used to make sure one target is built before another target. "
+ "Dependencies added to an IMPORTED target are followed transitively "
+ "in its place since the target itself does not build. "
"See the DEPENDS option of ADD_CUSTOM_TARGET "
"and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom "
"rules. See the OBJECT_DEPENDS option in "
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index 2aa6236..c8374db 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -93,14 +93,14 @@ bool cmCacheManager::LoadCache(const char* path,
return this->LoadCache(path, internal, emptySet, emptySet);
}
-bool cmCacheManager::ParseEntry(const char* entry,
- std::string& var,
- std::string& value)
+static bool ParseEntryWithoutType(const char* entry,
+ std::string& var,
+ std::string& value)
{
- // input line is: key:type=value
+ // input line is: key=value
static cmsys::RegularExpression reg(
- "^([^:]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
- // input line is: "key":type=value
+ "^([^=]*)=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
+ // input line is: "key"=value
static cmsys::RegularExpression regQuoted(
"^\"([^\"]*)\"=(.*[^\r\t ]|[\r\t ]*)[\r\t ]*$");
bool flag = false;
@@ -169,6 +169,11 @@ bool cmCacheManager::ParseEntry(const char* entry,
value.size() - 2);
}
+ if (!flag)
+ {
+ return ParseEntryWithoutType(entry, var, value);
+ }
+
return flag;
}
@@ -336,7 +341,7 @@ bool cmCacheManager::LoadCache(const char* path,
std::string("The current CMakeCache.txt directory ") +
currentcwd + std::string(" is different than the directory ") +
std::string(this->GetCacheValue("CMAKE_CACHEFILE_DIR")) +
- std::string(" where CMackeCache.txt was created. This may result "
+ std::string(" where CMakeCache.txt was created. This may result "
"in binaries being created in the wrong place. If you "
"are not sure, reedit the CMakeCache.txt");
cmSystemTools::Error(message.c_str());
diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h
index da14966..314017b 100644
--- a/Source/cmCacheManager.h
+++ b/Source/cmCacheManager.h
@@ -139,10 +139,6 @@ public:
std::string& value,
CacheEntryType& type);
- static bool ParseEntry(const char* entry,
- std::string& var,
- std::string& value);
-
///! Get a value from the cache given a key
const char* GetCacheValue(const char* key) const;
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 1cabed2..d53200c 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -923,7 +923,7 @@ void cmComputeLinkInformation::ComputeItemParserInfo()
//----------------------------------------------------------------------------
void cmComputeLinkInformation::AddLinkPrefix(const char* p)
{
- if(p)
+ if(p && *p)
{
this->LinkPrefixes.insert(p);
}
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 313c680..a4ca363 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -144,7 +144,7 @@ bool cmComputeTargetDepends::Compute()
//----------------------------------------------------------------------------
void
cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
- std::set<cmTarget*>& deps)
+ cmTargetDependSet& deps)
{
// Lookup the index for this target. All targets should be known by
// this point.
@@ -156,7 +156,9 @@ cmComputeTargetDepends::GetTargetDirectDepends(cmTarget* t,
EdgeList const& nl = this->FinalGraph[i];
for(EdgeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
{
- deps.insert(this->Targets[*ni]);
+ cmTarget* dep = this->Targets[*ni];
+ cmTargetDependSet::iterator di = deps.insert(dep).first;
+ di->SetType(ni->IsStrong());
}
}
@@ -244,13 +246,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
// Check the target's makefile first.
cmTarget* dependee =
- depender->GetMakefile()->FindTarget(dependee_name);
-
- // Then search globally.
- if(!dependee)
- {
- dependee = this->GlobalGenerator->FindTarget(0, dependee_name);
- }
+ depender->GetMakefile()->FindTargetToUse(dependee_name);
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
@@ -262,25 +258,42 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
dependee = 0;
}
- // If not found then skip then the dependee.
- if(!dependee)
+ if(dependee)
{
- return;
+ this->AddTargetDepend(depender_index, dependee, linking);
}
+}
- // No imported targets should have been found.
- assert(!dependee->IsImported());
-
- // Lookup the index for this target. All targets should be known by
- // this point.
- std::map<cmTarget*, int>::const_iterator tii =
- this->TargetIndex.find(dependee);
- assert(tii != this->TargetIndex.end());
- int dependee_index = tii->second;
-
- // Add this entry to the dependency graph.
- this->InitialGraph[depender_index].push_back(
- cmGraphEdge(dependee_index, !linking));
+//----------------------------------------------------------------------------
+void cmComputeTargetDepends::AddTargetDepend(int depender_index,
+ cmTarget* dependee,
+ bool linking)
+{
+ if(dependee->IsImported())
+ {
+ // Skip imported targets but follow their utility dependencies.
+ std::set<cmStdString> const& utils = dependee->GetUtilities();
+ for(std::set<cmStdString>::const_iterator i = utils.begin();
+ i != utils.end(); ++i)
+ {
+ cmTarget* transitive_dependee =
+ dependee->GetMakefile()->FindTargetToUse(i->c_str());
+ this->AddTargetDepend(depender_index, transitive_dependee, false);
+ }
+ }
+ else
+ {
+ // Lookup the index for this target. All targets should be known by
+ // this point.
+ std::map<cmTarget*, int>::const_iterator tii =
+ this->TargetIndex.find(dependee);
+ assert(tii != this->TargetIndex.end());
+ int dependee_index = tii->second;
+
+ // Add this entry to the dependency graph.
+ this->InitialGraph[depender_index].push_back(
+ cmGraphEdge(dependee_index, !linking));
+ }
}
//----------------------------------------------------------------------------
@@ -445,7 +458,7 @@ cmComputeTargetDepends
int j = *ei;
if(cmap[j] == c && ei->IsStrong())
{
- this->FinalGraph[i].push_back(j);
+ this->FinalGraph[i].push_back(cmGraphEdge(j, true));
if(!this->IntraComponent(cmap, c, j, head, emitted, visited))
{
return false;
@@ -456,7 +469,7 @@ cmComputeTargetDepends
// Prepend to a linear linked-list of intra-component edges.
if(*head >= 0)
{
- this->FinalGraph[i].push_back(*head);
+ this->FinalGraph[i].push_back(cmGraphEdge(*head, false));
}
else
{
@@ -515,7 +528,7 @@ cmComputeTargetDepends
int dependee_component = *ni;
int dependee_component_head = this->ComponentHead[dependee_component];
this->FinalGraph[depender_component_tail]
- .push_back(dependee_component_head);
+ .push_back(cmGraphEdge(dependee_component_head, ni->IsStrong()));
}
}
return true;
diff --git a/Source/cmComputeTargetDepends.h b/Source/cmComputeTargetDepends.h
index 240de76..67bce72 100644
--- a/Source/cmComputeTargetDepends.h
+++ b/Source/cmComputeTargetDepends.h
@@ -21,6 +21,7 @@
class cmComputeComponentGraph;
class cmGlobalGenerator;
class cmTarget;
+class cmTargetDependSet;
/** \class cmComputeTargetDepends
* \brief Compute global interdependencies among targets.
@@ -38,13 +39,14 @@ public:
bool Compute();
std::vector<cmTarget*> const& GetTargets() const { return this->Targets; }
- void GetTargetDirectDepends(cmTarget* t, std::set<cmTarget*>& deps);
+ void GetTargetDirectDepends(cmTarget* t, cmTargetDependSet& deps);
private:
void CollectTargets();
void CollectDepends();
void CollectTargetDepends(int depender_index);
void AddTargetDepend(int depender_index, const char* dependee_name,
bool linking);
+ void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking);
bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
cmGlobalGenerator* GlobalGenerator;
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index e6d7a6d..a5650d4 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -23,7 +23,7 @@
#include <cmsys/SystemTools.hxx>
/* Some useful URLs:
-Homepage:
+Homepage:
http://www.codeblocks.org
File format docs:
@@ -63,16 +63,6 @@ cmExtraCodeBlocksGenerator::cmExtraCodeBlocksGenerator()
}
-void cmExtraCodeBlocksGenerator::SetGlobalGenerator(
- cmGlobalGenerator* generator)
-{
- cmExternalMakefileProjectGenerator::SetGlobalGenerator(generator);
- cmGlobalUnixMakefileGenerator3* mf = (cmGlobalUnixMakefileGenerator3*)
- generator;
- mf->SetToolSupportsColor(false);
- mf->SetForceVerboseMakefiles(true);
-}
-
void cmExtraCodeBlocksGenerator::Generate()
{
// for each sub project in the project create a codeblocks project
@@ -107,7 +97,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile(
/* Tree is used to create a "Virtual Folder" in CodeBlocks, in which all
CMake files this project depends on will be put. This means additionally
to the "Sources" and "Headers" virtual folders of CodeBlocks, there will
- now also be a "CMake Files" virtual folder.
+ now also be a "CMake Files" virtual folder.
Patch by Daniel Teske <daniel.teske AT nokia.com> (which use C::B project
files in QtCreator).*/
struct Tree
@@ -115,24 +105,24 @@ struct Tree
std::string path; //only one component of the path
std::vector<Tree> folders;
std::vector<std::string> files;
- void InsertPath(const std::vector<std::string>& splitted,
- std::vector<std::string>::size_type start,
+ void InsertPath(const std::vector<std::string>& splitted,
+ std::vector<std::string>::size_type start,
const std::string& fileName);
void BuildVirtualFolder(std::string& virtualFolders) const;
- void BuildVirtualFolderImpl(std::string& virtualFolders,
+ void BuildVirtualFolderImpl(std::string& virtualFolders,
const std::string& prefix) const;
void BuildUnit(std::string& unitString, const std::string& fsPath) const;
- void BuildUnitImpl(std::string& unitString,
- const std::string& virtualFolderPath,
+ void BuildUnitImpl(std::string& unitString,
+ const std::string& virtualFolderPath,
const std::string& fsPath) const;
};
-void Tree::InsertPath(const std::vector<std::string>& splitted,
- std::vector<std::string>::size_type start,
+void Tree::InsertPath(const std::vector<std::string>& splitted,
+ std::vector<std::string>::size_type start,
const std::string& fileName)
{
- if (start == splitted.size())
+ if (start == splitted.size())
{
files.push_back(fileName);
return;
@@ -301,7 +291,7 @@ void cmExtraCodeBlocksGenerator
}
// Now build a virtual tree string
- std::string virtualFolders;
+ std::string virtualFolders;
tree.BuildVirtualFolder(virtualFolders);
// And one for <Unit>
std::string unitFiles;
@@ -323,7 +313,7 @@ void cmExtraCodeBlocksGenerator
this->AppendTarget(fout, "all", 0, make.c_str(), mf, compiler.c_str());
- // add all executable and library targets and some of the GLOBAL
+ // add all executable and library targets and some of the GLOBAL
// and UTILITY targets
for (std::vector<cmLocalGenerator*>::const_iterator lg=lgs.begin();
lg!=lgs.end(); lg++)
@@ -338,9 +328,9 @@ void cmExtraCodeBlocksGenerator
case cmTarget::GLOBAL_TARGET:
{
bool insertTarget = false;
- // Only add the global targets from CMAKE_BINARY_DIR,
+ // Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
- if (strcmp(makefile->GetStartOutputDirectory(),
+ if (strcmp(makefile->GetStartOutputDirectory(),
makefile->GetHomeOutputDirectory())==0)
{
insertTarget = true;
@@ -362,7 +352,7 @@ void cmExtraCodeBlocksGenerator
}
if (insertTarget)
{
- this->AppendTarget(fout, ti->first.c_str(), 0,
+ this->AppendTarget(fout, ti->first.c_str(), 0,
make.c_str(), makefile, compiler.c_str());
}
}
@@ -372,13 +362,13 @@ void cmExtraCodeBlocksGenerator
// Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
- || ((ti->first.find("Experimental")==0)
+ || ((ti->first.find("Experimental")==0)
&& (ti->first!="Experimental")))
{
break;
}
- this->AppendTarget(fout, ti->first.c_str(), 0,
+ this->AppendTarget(fout, ti->first.c_str(), 0,
make.c_str(), makefile, compiler.c_str());
break;
case cmTarget::EXECUTABLE:
@@ -386,11 +376,11 @@ void cmExtraCodeBlocksGenerator
case cmTarget::SHARED_LIBRARY:
case cmTarget::MODULE_LIBRARY:
{
- this->AppendTarget(fout, ti->first.c_str(), &ti->second,
+ this->AppendTarget(fout, ti->first.c_str(), &ti->second,
make.c_str(), makefile, compiler.c_str());
std::string fastTarget = ti->first;
fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget.c_str(), &ti->second,
+ this->AppendTarget(fout, fastTarget.c_str(), &ti->second,
make.c_str(), makefile, compiler.c_str());
}
break;
@@ -437,7 +427,7 @@ void cmExtraCodeBlocksGenerator
{
for(std::vector<std::string>::const_iterator
ext = mf->GetSourceExtensions().begin();
- ext != mf->GetSourceExtensions().end();
+ ext != mf->GetSourceExtensions().end();
++ext)
{
if ((*si)->GetExtension() == *ext)
@@ -467,11 +457,11 @@ void cmExtraCodeBlocksGenerator
// The following loop tries to add header files matching to implementation
// files to the project. It does that by iterating over all source files,
- // replacing the file name extension with ".h" and checks whether such a
+ // replacing the file name extension with ".h" and checks whether such a
// file exists. If it does, it is inserted into the map of files.
// A very similar version of that code exists also in the kdevelop
// project generator.
- for (std::map<std::string, cmSourceFile*>::const_iterator
+ for (std::map<std::string, cmSourceFile*>::const_iterator
sit=cFiles.begin();
sit!=cFiles.end();
++sit)
@@ -483,7 +473,7 @@ void cmExtraCodeBlocksGenerator
// check if there's a matching header around
for(std::vector<std::string>::const_iterator
ext = mf->GetHeaderExtensions().begin();
- ext != mf->GetHeaderExtensions().end();
+ ext != mf->GetHeaderExtensions().end();
++ext)
{
std::string hname=headerBasename;
@@ -506,7 +496,7 @@ void cmExtraCodeBlocksGenerator
// insert all source files in the CodeBlocks project
// first the C/C++ implementation files, then all others
- for (std::map<std::string, cmSourceFile*>::const_iterator
+ for (std::map<std::string, cmSourceFile*>::const_iterator
sit=cFiles.begin();
sit!=cFiles.end();
++sit)
@@ -514,7 +504,7 @@ void cmExtraCodeBlocksGenerator
fout<<" <Unit filename=\""<< sit->first <<"\">\n"
" </Unit>\n";
}
- for (std::set<std::string>::const_iterator
+ for (std::set<std::string>::const_iterator
sit=otherFiles.begin();
sit!=otherFiles.end();
++sit)
@@ -577,7 +567,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
" <Option compiler=\"" << compiler << "\" />\n"
" <Compiler>\n";
// the include directories for this target
- const std::vector<std::string>& incDirs =
+ const std::vector<std::string>& incDirs =
target->GetMakefile()->GetIncludeDirectories();
for(std::vector<std::string>::const_iterator dirIt=incDirs.begin();
dirIt != incDirs.end();
@@ -589,27 +579,27 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
}
else // e.g. all and the GLOBAL and UTILITY targets
{
- fout<<" <Option working_dir=\""
+ fout<<" <Option working_dir=\""
<< makefile->GetStartOutputDirectory() << "\" />\n"
<<" <Option type=\"" << 4 << "\" />\n";
}
fout<<" <MakeCommands>\n"
- " <Build command=\""
+ " <Build command=\""
<< this->BuildMakeCommand(make, makefileName.c_str(), targetName)
<< "\" />\n"
- " <CompileFile command=\""
+ " <CompileFile command=\""
<< this->BuildMakeCommand(make, makefileName.c_str(),"&quot;$file&quot;")
<< "\" />\n"
- " <Clean command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
+ " <Clean command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
<< "\" />\n"
- " <DistClean command=\""
- << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
+ " <DistClean command=\""
+ << this->BuildMakeCommand(make, makefileName.c_str(), "clean")
<< "\" />\n"
" </MakeCommands>\n"
" </Target>\n";
-
+
}
@@ -675,7 +665,7 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
{
return 2;
}
- else if ((target->GetType()==cmTarget::SHARED_LIBRARY)
+ else if ((target->GetType()==cmTarget::SHARED_LIBRARY)
|| (target->GetType()==cmTarget::MODULE_LIBRARY))
{
return 3;
@@ -695,16 +685,18 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += " /NOLOGO /f &quot;";
command += makefileName;
command += "&quot; ";
+ command += " VERBOSE=1 ";
command += target;
}
else if (strcmp(this->GlobalGenerator->GetName(), "MinGW Makefiles")==0)
{
- // no escaping of spaces in this case, see
+ // no escaping of spaces in this case, see
// http://public.kitware.com/Bug/view.php?id=10014
- std::string makefileName = makefile;
+ std::string makefileName = makefile;
command += " -f &quot;";
command += makefileName;
command += "&quot; ";
+ command += " VERBOSE=1 ";
command += target;
}
else
@@ -713,6 +705,7 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
command += " -f &quot;";
command += makefileName;
command += "&quot; ";
+ command += " VERBOSE=1 ";
command += target;
}
return command;
diff --git a/Source/cmExtraCodeBlocksGenerator.h b/Source/cmExtraCodeBlocksGenerator.h
index 97a2d24..57751fc 100644
--- a/Source/cmExtraCodeBlocksGenerator.h
+++ b/Source/cmExtraCodeBlocksGenerator.h
@@ -22,22 +22,19 @@ class cmGeneratedFileStream;
/** \class cmExtraCodeBlocksGenerator
* \brief Write CodeBlocks project files for Makefile based projects
- *
- * This generator is in early alpha stage.
*/
class cmExtraCodeBlocksGenerator : public cmExternalMakefileProjectGenerator
{
public:
cmExtraCodeBlocksGenerator();
- virtual void SetGlobalGenerator(cmGlobalGenerator* generator);
virtual const char* GetName() const
{ return cmExtraCodeBlocksGenerator::GetActualName();}
static const char* GetActualName() { return "CodeBlocks";}
- static cmExternalMakefileProjectGenerator* New()
+ static cmExternalMakefileProjectGenerator* New()
{ return new cmExtraCodeBlocksGenerator; }
/** Get the documentation entry for this generator. */
- virtual void GetDocumentation(cmDocumentationEntry& entry,
+ virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const;
virtual void Generate();
@@ -49,7 +46,7 @@ private:
const std::string& filename);
std::string GetCBCompilerId(const cmMakefile* mf);
int GetCBTargetType(cmTarget* target);
- std::string BuildMakeCommand(const std::string& make, const char* makefile,
+ std::string BuildMakeCommand(const std::string& make, const char* makefile,
const char* target);
void AppendTarget(cmGeneratedFileStream& fout,
const char* targetName,
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 204d5d7..502fefa 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -52,16 +52,6 @@ void cmExtraEclipseCDT4Generator
}
//----------------------------------------------------------------------------
-void cmExtraEclipseCDT4Generator
-::SetGlobalGenerator(cmGlobalGenerator* generator)
-{
- cmExternalMakefileProjectGenerator::SetGlobalGenerator(generator);
- cmGlobalUnixMakefileGenerator3* mf
- = static_cast<cmGlobalUnixMakefileGenerator3*>(generator);
- mf->SetToolSupportsColor(true);
-}
-
-//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator::Generate()
{
const cmMakefile* mf
@@ -73,7 +63,7 @@ void cmExtraEclipseCDT4Generator::Generate()
this->IsOutOfSourceBuild = (this->HomeDirectory!=this->HomeOutputDirectory);
- this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
+ this->GenerateSourceProject = (this->IsOutOfSourceBuild &&
mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"));
// NOTE: This is not good, since it pollutes the source tree. However,
@@ -109,7 +99,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
return;
}
- fout <<
+ fout <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<projectDescription>\n"
"\t<name>" << name << "</name>\n"
@@ -129,7 +119,7 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile() const
void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
const char* envVar, cmMakefile* mf)
{
- // get the variables from the environment and from the cache and then
+ // get the variables from the environment and from the cache and then
// figure out which one to use:
const char* envVarValue = getenv(envVar);
@@ -148,7 +138,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
}
else if (envVarValue!=0 && cacheValue==0)
{
- // The variable is in the env, but not in the cache. Use it and put it
+ // The variable is in the env, but not in the cache. Use it and put it
// in the cache
valueToUse = envVarValue;
mf->AddCacheDefinition(cacheEntryName.c_str(), valueToUse.c_str(),
@@ -206,7 +196,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
compilerId = mf->GetSafeDefinition("CMAKE_CXX_COMPILER_ID");
}
- fout <<
+ fout <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<projectDescription>\n"
"\t<name>" <<
@@ -225,7 +215,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
;
// use clean target
- fout <<
+ fout <<
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>\n"
"\t\t\t\t\t<value>clean</value>\n"
@@ -246,7 +236,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
// set the make command
std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
- fout <<
+ fout <<
"\t\t\t\t<dictionary>\n"
"\t\t\t\t\t<key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>\n"
"\t\t\t\t\t<value>true</value>\n"
@@ -296,7 +286,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
else if (compilerId == "Intel")
{
// if the env.var is set, use this one and put it in the cache
- // if the env.var is not set, but the value is in the cache,
+ // if the env.var is not set, but the value is in the cache,
// use it from the cache:
AddEnvVar(fout, "INTEL_LICENSE_FILE", mf);
}
@@ -392,9 +382,9 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
{
fout << "\t<linkedResources>\n";
// create a linked resource to CMAKE_SOURCE_DIR
- // (this is not done anymore for each project because of
- // http://public.kitware.com/Bug/view.php?id=9978 and because I found it
- // actually quite confusing in bigger projects with many directories and
+ // (this is not done anymore for each project because of
+ // http://public.kitware.com/Bug/view.php?id=9978 and because I found it
+ // actually quite confusing in bigger projects with many directories and
// projects, Alex
std::string sourceLinkedResourceName = "[Source directory]";
@@ -440,7 +430,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
if(emittedDirs.find(dir) == emittedDirs.end())
{
emittedDirs.insert(dir);
- fout << "<pathentry include=\""
+ fout << "<pathentry include=\""
<< cmExtraEclipseCDT4Generator::GetEclipsePath(dir)
<< "\" kind=\"inc\" path=\"\" system=\"true\"/>\n";
}
@@ -452,7 +442,7 @@ void cmExtraEclipseCDT4Generator::AppendIncludeDirectories(
void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{
std::set<std::string> emmited;
-
+
const cmMakefile* mf
= this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
@@ -465,7 +455,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
// add header
- fout <<
+ fout <<
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
"<?fileVersion 4.0.0?>\n\n"
"<cproject>\n"
@@ -475,7 +465,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
fout << "<cconfiguration id=\"org.eclipse.cdt.core.default.config.1\">\n";
// Configuration settings...
- fout <<
+ fout <<
"<storageModule"
" buildSystemId=\"org.eclipse.cdt.core.defaultConfigDataProvider\""
" id=\"org.eclipse.cdt.core.default.config.1\""
@@ -536,9 +526,9 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
fout << "</extensions>\n"
"</storageModule>\n"
;
-
+
// ???
- fout <<
+ fout <<
"<storageModule moduleId=\"org.eclipse.cdt.core.language.mapping\">\n"
"<project-mappings/>\n"
"</storageModule>\n"
@@ -619,13 +609,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// we have -DFOO
def = *di;
}
-
+
// insert the definition if not already added.
if(emmited.find(def) == emmited.end())
{
emmited.insert(def);
fout << "<pathentry kind=\"mac\" name=\"" << def
- << "\" path=\"\" value=\"" << this->EscapeForXML(val)
+ << "\" path=\"\" value=\"" << this->EscapeForXML(val)
<< "\"/>\n";
}
}
@@ -712,8 +702,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
= (*it)->GetMakefile()->GetIncludeDirectories();
this->AppendIncludeDirectories(fout, includeDirs, emmited);
}
- // now also the system include directories, in case we found them in
- // CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
+ // now also the system include directories, in case we found them in
+ // CMakeSystemSpecificInformation.cmake. This makes Eclipse find the
// standard headers.
mf->GetDefinition("CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS");
std::string compiler = mf->GetSafeDefinition("CMAKE_C_COMPILER");
@@ -738,15 +728,17 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
fout << "</storageModule>\n";
// add build targets
- fout <<
+ fout <<
"<storageModule moduleId=\"org.eclipse.cdt.make.core.buildtargets\">\n"
"<buildTargets>\n"
;
emmited.clear();
const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+ const std::string makeArgs = mf->GetSafeDefinition(
+ "CMAKE_ECLIPSE_MAKE_ARGUMENTS");
cmGlobalGenerator* generator
= const_cast<cmGlobalGenerator*>(this->GlobalGenerator);
-
+
std::string allTarget;
std::string cleanTarget;
if (generator->GetAllTargetName())
@@ -758,7 +750,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
cleanTarget = generator->GetCleanTargetName();
}
- // add all executable and library targets and some of the GLOBAL
+ // add all executable and library targets and some of the GLOBAL
// and UTILITY targets
for (std::vector<cmLocalGenerator*>::const_iterator
it = this->GlobalGenerator->GetLocalGenerators().begin();
@@ -781,7 +773,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
case cmTarget::GLOBAL_TARGET:
{
bool insertTarget = false;
- // Only add the global targets from CMAKE_BINARY_DIR,
+ // Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (subdir.empty())
{
@@ -804,7 +796,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
}
if (insertTarget)
{
- this->AppendTarget(fout, ti->first, make, subdir, ": ");
+ this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
}
}
break;
@@ -813,13 +805,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// Experimental-"sub"targets as e.g. NightlyStart
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
- || ((ti->first.find("Experimental")==0)
+ || ((ti->first.find("Experimental")==0)
&& (ti->first!="Experimental")))
{
break;
}
- this->AppendTarget(fout, ti->first, make, subdir, ": ");
+ this->AppendTarget(fout, ti->first, make, makeArgs, subdir, ": ");
break;
case cmTarget::EXECUTABLE:
case cmTarget::STATIC_LIBRARY:
@@ -828,10 +820,10 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{
const char* prefix = (ti->second.GetType()==cmTarget::EXECUTABLE ?
"[exe] " : "[lib] ");
- this->AppendTarget(fout, ti->first, make, subdir, prefix);
+ this->AppendTarget(fout, ti->first, make, makeArgs, subdir, prefix);
std::string fastTarget = ti->first;
fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget, make, subdir, prefix);
+ this->AppendTarget(fout, fastTarget, make, makeArgs, subdir, prefix);
}
break;
// ignore these:
@@ -842,15 +834,15 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
break;
}
}
-
+
// insert the all and clean targets in every subdir
if (!allTarget.empty())
{
- this->AppendTarget(fout, allTarget, make, subdir, ": ");
+ this->AppendTarget(fout, allTarget, make, makeArgs, subdir, ": ");
}
if (!cleanTarget.empty())
{
- this->AppendTarget(fout, cleanTarget, make, subdir, ": ");
+ this->AppendTarget(fout, cleanTarget, make, makeArgs, subdir, ": ");
}
//insert rules for compiling, preprocessing and assembling individual files
@@ -870,7 +862,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{
prefix = "[pre] ";
}
- this->AppendTarget(fout, *fit, make, subdir, prefix);
+ this->AppendTarget(fout, *fit, make, makeArgs, subdir, prefix);
}
}
@@ -955,7 +947,7 @@ std::string cmExtraEclipseCDT4Generator::EscapeForXML(const std::string& value)
// Helper functions
//----------------------------------------------------------------------------
void cmExtraEclipseCDT4Generator
-::AppendStorageScanners(cmGeneratedFileStream& fout,
+::AppendStorageScanners(cmGeneratedFileStream& fout,
const cmMakefile& makefile)
{
// we need the "make" and the C (or C++) compiler which are used, Alex
@@ -972,7 +964,7 @@ void cmExtraEclipseCDT4Generator
// the following right now hardcodes gcc behaviour :-/
- fout <<
+ fout <<
"<storageModule moduleId=\"scannerConfiguration\">\n"
"<autodiscovery enabled=\"true\" problemReportingEnabled=\"true\""
" selectedProfileId="
@@ -996,24 +988,25 @@ void cmExtraEclipseCDT4Generator
// of that is to sort the targets in the view of Eclipse, so that at first
// the global/utility/all/clean targets appear ": ", then the executable
// targets "[exe] ", then the libraries "[lib]", then the rules for the
-// object files "[obj]", then for preprocessing only "[pre] " and
-// finally the assembly files "[to asm] ". Note the "to" in "to asm",
+// object files "[obj]", then for preprocessing only "[pre] " and
+// finally the assembly files "[to asm] ". Note the "to" in "to asm",
// without it, "asm" would be the first targets in the list, with the "to"
// they are the last targets, which makes more sense.
void cmExtraEclipseCDT4Generator::AppendTarget(cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
+ const std::string& makeArgs,
const std::string& path,
const char* prefix)
{
- fout <<
+ fout <<
"<target name=\"" << prefix << target << "\""
" path=\"" << path.c_str() << "\""
" targetID=\"org.eclipse.cdt.make.MakeTargetBuilder\">\n"
"<buildCommand>"
<< cmExtraEclipseCDT4Generator::GetEclipsePath(make)
<< "</buildCommand>\n"
- "<buildArguments/>\n"
+ "<buildArguments>" << makeArgs << "</buildArguments>\n"
"<buildTarget>" << target << "</buildTarget>\n"
"<stopOnError>true</stopOnError>\n"
"<useDefaultCommand>false</useDefaultCommand>\n"
@@ -1033,7 +1026,7 @@ void cmExtraEclipseCDT4Generator
bool runActionUseDefault,
bool sipParserEnabled)
{
- fout <<
+ fout <<
"<profile id=\"" << profileID << "\">\n"
"<buildOutputProvider>\n"
"<openAction enabled=\"" << (openActionEnabled ? "true" : "false")
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 143b7fa..99e69c4 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -21,8 +21,6 @@ class cmGeneratedFileStream;
/** \class cmExtraEclipseCDT4Generator
* \brief Write Eclipse project files for Makefile based projects
- *
- * This generator is in early alpha stage.
*/
class cmExtraEclipseCDT4Generator : public cmExternalMakefileProjectGenerator
{
@@ -42,8 +40,6 @@ public:
virtual void GetDocumentation(cmDocumentationEntry& entry,
const char* fullName) const;
- virtual void SetGlobalGenerator(cmGlobalGenerator* generator);
-
virtual void Generate();
private:
@@ -70,11 +66,12 @@ private:
static std::string EscapeForXML(const std::string& value);
// Helper functions
- static void AppendStorageScanners(cmGeneratedFileStream& fout,
+ static void AppendStorageScanners(cmGeneratedFileStream& fout,
const cmMakefile& makefile);
static void AppendTarget (cmGeneratedFileStream& fout,
const std::string& target,
const std::string& make,
+ const std::string& makeArguments,
const std::string& path,
const char* prefix = "");
static void AppendScannerProfile (cmGeneratedFileStream& fout,
@@ -100,7 +97,7 @@ private:
const std::vector<std::string>& includeDirs,
std::set<std::string>& emittedDirs);
- static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
+ static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
cmMakefile* mf);
std::vector<std::string> SrcLinkedResources;
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index e1188d5..d0fe99f 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -13,11 +13,17 @@
cmFindBase::cmFindBase()
{
- cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
- "FIND_ARGS_XXX", "<VAR> NAMES name");
this->AlreadyInCache = false;
this->AlreadyInCacheWithoutMetaInfo = false;
- this->GenericDocumentation =
+}
+
+//----------------------------------------------------------------------------
+void cmFindBase::GenerateDocumentation()
+{
+ this->cmFindCommon::GenerateDocumentation();
+ cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
+ "FIND_ARGS_XXX", "<VAR> NAMES name");
+ this->GenericDocumentation =
" FIND_XXX(<VAR> name1 [path1 path2 ...])\n"
"This is the short-hand signature for the command that "
"is sufficient in many cases. It is the same "
@@ -97,7 +103,18 @@ cmFindBase::cmFindBase()
this->GenericDocumentation += this->GenericDocumentationRootPath;
this->GenericDocumentation += this->GenericDocumentationPathsOrder;
}
-
+
+//----------------------------------------------------------------------------
+const char* cmFindBase::GetFullDocumentation()
+{
+ if(this->GenericDocumentation.empty())
+ {
+ this->GenerateDocumentation();
+ }
+ return this->GenericDocumentation.c_str();
+}
+
+//----------------------------------------------------------------------------
bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
{
if(argsIn.size() < 2 )
@@ -147,6 +164,11 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
}
}
}
+ if(args.size() < 2 )
+ {
+ this->SetError("called with incorrect number of arguments");
+ return false;
+ }
this->VariableName = args[0];
if(this->CheckForVariableInCache())
{
diff --git a/Source/cmFindBase.h b/Source/cmFindBase.h
index 2f1727e..de319b1 100644
--- a/Source/cmFindBase.h
+++ b/Source/cmFindBase.h
@@ -31,10 +31,10 @@ public:
virtual bool ParseArguments(std::vector<std::string> const& args);
cmTypeMacro(cmFindBase, cmFindCommon);
- virtual const char* GetFullDocumentation()
- {return this->GenericDocumentation.c_str();}
+ virtual const char* GetFullDocumentation();
protected:
+ virtual void GenerateDocumentation();
void PrintFindStuff();
void ExpandPaths();
void AddPathSuffixes();
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index b7d3e52..a05e337 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -34,7 +34,11 @@ cmFindCommon::cmFindCommon()
this->SearchFrameworkLast = false;
this->SearchAppBundleOnly = false;
this->SearchAppBundleLast = false;
+}
+//----------------------------------------------------------------------------
+void cmFindCommon::GenerateDocumentation()
+{
// Documentation components.
this->GenericDocumentationMacPolicy =
"On Darwin or systems supporting OS X Frameworks, the cmake variable"
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index a4866ba..875c223 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -56,6 +56,8 @@ protected:
/** Compute the current default bundle/framework search policy. */
void SelectDefaultMacMode();
+ virtual void GenerateDocumentation();
+
cmStdString CMakePathName;
RootPathMode FindRootPathMode;
diff --git a/Source/cmFindFileCommand.cxx b/Source/cmFindFileCommand.cxx
index 897b4bb..fa66fa1 100644
--- a/Source/cmFindFileCommand.cxx
+++ b/Source/cmFindFileCommand.cxx
@@ -15,11 +15,16 @@
cmFindFileCommand::cmFindFileCommand()
{
this->IncludeFileInPath = true;
+}
+
+void cmFindFileCommand::GenerateDocumentation()
+{
+ this->cmFindPathCommand::GenerateDocumentation();
cmSystemTools::ReplaceString(this->GenericDocumentation,
"find_path", "find_file");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "directory containing the named file",
+ "directory containing the named file",
"full path to named file");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "file in a directory", "full path to a file");
+ "file in a directory", "full path to a file");
}
diff --git a/Source/cmFindFileCommand.h b/Source/cmFindFileCommand.h
index aa0d25e..dd2e01d 100644
--- a/Source/cmFindFileCommand.h
+++ b/Source/cmFindFileCommand.h
@@ -44,6 +44,8 @@ public:
}
cmTypeMacro(cmFindFileCommand, cmFindPathCommand);
+protected:
+ virtual void GenerateDocumentation();
};
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 9077c8e..b309376 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -16,6 +16,13 @@
cmFindLibraryCommand::cmFindLibraryCommand()
{
+ this->EnvironmentPath = "LIB";
+}
+
+//----------------------------------------------------------------------------
+void cmFindLibraryCommand::GenerateDocumentation()
+{
+ this->cmFindBase::GenerateDocumentation();
cmSystemTools::ReplaceString(this->GenericDocumentation,
"FIND_XXX", "find_library");
cmSystemTools::ReplaceString(this->GenericDocumentation,
@@ -29,7 +36,7 @@ cmFindLibraryCommand::cmFindLibraryCommand()
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SYSTEM", "LIB");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_SYSTEM_XXX_PATH",
+ "CMAKE_SYSTEM_XXX_PATH",
"CMAKE_SYSTEM_LIBRARY_PATH");
cmSystemTools::ReplaceString(this->GenericDocumentation,
"SEARCH_XXX_DESC", "library");
@@ -38,11 +45,9 @@ cmFindLibraryCommand::cmFindLibraryCommand()
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "lib");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_FIND_ROOT_PATH_MODE_XXX",
+ "CMAKE_FIND_ROOT_PATH_MODE_XXX",
"CMAKE_FIND_ROOT_PATH_MODE_LIBRARY");
-
- this->EnvironmentPath = "LIB";
- this->GenericDocumentation +=
+ this->GenericDocumentation +=
"\n"
"If the library found is a framework, then VAR will be set to "
"the full path to the framework <fullPath>/A.framework. "
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index 486c2cf..7930f52 100644
--- a/Source/cmFindLibraryCommand.h
+++ b/Source/cmFindLibraryCommand.h
@@ -64,6 +64,7 @@ protected:
void AddArchitecturePaths(const char* suffix);
void AddLib64Paths();
std::string FindLibrary();
+ virtual void GenerateDocumentation();
private:
std::string FindNormalLibrary();
std::string FindFrameworkLibrary();
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index ef0197a..fdc1a01 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -51,13 +51,6 @@ void cmFindPackageNeedBackwardsCompatibility(const std::string& variable,
//----------------------------------------------------------------------------
cmFindPackageCommand::cmFindPackageCommand()
{
- cmSystemTools::ReplaceString(this->GenericDocumentationRootPath,
- "CMAKE_FIND_ROOT_PATH_MODE_XXX",
- "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE");
- cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
- "FIND_ARGS_XXX", "<package>");
- cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
- "FIND_XXX", "find_package");
this->CMakePathName = "PACKAGE";
this->Quiet = false;
this->Required = false;
@@ -78,6 +71,19 @@ cmFindPackageCommand::cmFindPackageCommand()
this->VersionFoundPatch = 0;
this->VersionFoundTweak = 0;
this->VersionFoundCount = 0;
+}
+
+//----------------------------------------------------------------------------
+void cmFindPackageCommand::GenerateDocumentation()
+{
+ this->cmFindCommon::GenerateDocumentation();
+ cmSystemTools::ReplaceString(this->GenericDocumentationRootPath,
+ "CMAKE_FIND_ROOT_PATH_MODE_XXX",
+ "CMAKE_FIND_ROOT_PATH_MODE_PACKAGE");
+ cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
+ "FIND_ARGS_XXX", "<package>");
+ cmSystemTools::ReplaceString(this->GenericDocumentationPathsOrder,
+ "FIND_XXX", "find_package");
this->CommandDocumentation =
" find_package(<package> [version] [EXACT] [QUIET]\n"
" [[REQUIRED|COMPONENTS] [components...]]\n"
@@ -318,6 +324,10 @@ cmFindPackageCommand::cmFindPackageCommand()
//----------------------------------------------------------------------------
const char* cmFindPackageCommand::GetFullDocumentation()
{
+ if(this->CommandDocumentation.empty())
+ {
+ this->GenerateDocumentation();
+ }
return this->CommandDocumentation.c_str();
}
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index 57aeab9..19d2b10 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -65,6 +65,8 @@ public:
virtual const char* GetFullDocumentation();
cmTypeMacro(cmFindPackageCommand, cmFindCommon);
+protected:
+ virtual void GenerateDocumentation();
private:
void AppendSuccessInformation();
void AppendToProperty(const char* propertyName);
diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx
index cca243a..83b651b 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -18,6 +18,11 @@ cmFindPathCommand::cmFindPathCommand()
{
this->EnvironmentPath = "INCLUDE";
this->IncludeFileInPath = false;
+}
+
+void cmFindPathCommand::GenerateDocumentation()
+{
+ this->cmFindBase::GenerateDocumentation();
cmSystemTools::ReplaceString(this->GenericDocumentation,
"FIND_XXX", "find_path");
cmSystemTools::ReplaceString(this->GenericDocumentation,
@@ -31,27 +36,21 @@ cmFindPathCommand::cmFindPathCommand()
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SYSTEM", "INCLUDE");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_SYSTEM_XXX_PATH",
- "CMAKE_SYSTEM_INCLUDE_PATH");
+ "CMAKE_SYSTEM_XXX_PATH",
+ "CMAKE_SYSTEM_INCLUDE_PATH");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "SEARCH_XXX_DESC",
+ "SEARCH_XXX_DESC",
"directory containing the named file");
cmSystemTools::ReplaceString(this->GenericDocumentation,
"SEARCH_XXX", "file in a directory");
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "include");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_FIND_ROOT_PATH_MODE_XXX",
+ "CMAKE_FIND_ROOT_PATH_MODE_XXX",
"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE");
-
- this->ExtraDocAdded = false;
-}
-
-const char* cmFindPathCommand::GetFullDocumentation()
-{
- if(!this->ExtraDocAdded && !this->IncludeFileInPath)
+ if(!this->IncludeFileInPath)
{
- this->GenericDocumentation +=
+ this->GenericDocumentation +=
"\n"
"When searching for frameworks, if the file is specified as "
"A/b.h, then the framework search will look for "
@@ -59,9 +58,7 @@ const char* cmFindPathCommand::GetFullDocumentation()
"If that is found the path will be set to the path to the framework. "
"CMake will convert this to the correct -F option to include the "
"file. ";
- this->ExtraDocAdded = true;
}
- return this->GenericDocumentation.c_str();
}
// cmFindPathCommand
diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h
index 3c04343..bd94779 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -59,10 +59,10 @@ public:
return "Find the directory containing a file.";
}
- virtual const char* GetFullDocumentation();
cmTypeMacro(cmFindPathCommand, cmFindBase);
bool IncludeFileInPath;
- bool ExtraDocAdded;
+protected:
+ virtual void GenerateDocumentation();
private:
std::string FindHeaderInFramework(std::string const& file,
std::string const& dir);
diff --git a/Source/cmFindProgramCommand.cxx b/Source/cmFindProgramCommand.cxx
index 519f862..71cfdcb 100644
--- a/Source/cmFindProgramCommand.cxx
+++ b/Source/cmFindProgramCommand.cxx
@@ -16,9 +16,10 @@
#if defined(__APPLE__)
#include <CoreFoundation/CoreFoundation.h>
#endif
-
-cmFindProgramCommand::cmFindProgramCommand()
+
+void cmFindProgramCommand::GenerateDocumentation()
{
+ this->cmFindBase::GenerateDocumentation();
cmSystemTools::ReplaceString(this->GenericDocumentation,
"FIND_XXX", "find_program");
cmSystemTools::ReplaceString(this->GenericDocumentation,
@@ -32,8 +33,8 @@ cmFindProgramCommand::cmFindProgramCommand()
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SYSTEM", "");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_SYSTEM_XXX_PATH",
- "CMAKE_SYSTEM_PROGRAM_PATH");
+ "CMAKE_SYSTEM_XXX_PATH",
+ "CMAKE_SYSTEM_PROGRAM_PATH");
cmSystemTools::ReplaceString(this->GenericDocumentation,
"SEARCH_XXX_DESC", "program");
cmSystemTools::ReplaceString(this->GenericDocumentation,
@@ -41,7 +42,7 @@ cmFindProgramCommand::cmFindProgramCommand()
cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "[s]bin");
cmSystemTools::ReplaceString(this->GenericDocumentation,
- "CMAKE_FIND_ROOT_PATH_MODE_XXX",
+ "CMAKE_FIND_ROOT_PATH_MODE_XXX",
"CMAKE_FIND_ROOT_PATH_MODE_PROGRAM");
}
diff --git a/Source/cmFindProgramCommand.h b/Source/cmFindProgramCommand.h
index ae790a3..654e834 100644
--- a/Source/cmFindProgramCommand.h
+++ b/Source/cmFindProgramCommand.h
@@ -25,7 +25,6 @@
class cmFindProgramCommand : public cmFindBase
{
public:
- cmFindProgramCommand();
/**
* This is a virtual constructor for the command.
*/
@@ -63,6 +62,7 @@ public:
protected:
std::string FindProgram(std::vector<std::string> names);
+ virtual void GenerateDocumentation();
private:
std::string FindAppBundle(std::vector<std::string> names);
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 0def336..ea091f9 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -699,9 +699,8 @@ bool cmGlobalGenerator::IsDependedOn(const char* project,
l != targets.end(); l++)
{
cmTarget& target = l->second;
- std::set<cmStdString>::const_iterator pos =
- target.GetUtilities().find(targetIn->GetName());
- if(pos != target.GetUtilities().end())
+ TargetDependSet const& tgtdeps = this->GetTargetDirectDepends(target);
+ if(tgtdeps.count(targetIn))
{
return true;
}
@@ -815,24 +814,11 @@ void cmGlobalGenerator::Generate()
// For each existing cmLocalGenerator
unsigned int i;
- // Consolidate global targets
+ // Put a copy of each global target in every directory.
cmTargets globalTargets;
this->CreateDefaultGlobalTargets(&globalTargets);
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- cmTargets* targets =
- &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
- cmTargets::iterator tarIt;
- for ( tarIt = targets->begin(); tarIt != targets->end(); ++ tarIt )
- {
- if ( tarIt->second.GetType() == cmTarget::GLOBAL_TARGET )
- {
- globalTargets[tarIt->first] = tarIt->second;
- }
- }
- }
- for (i = 0; i < this->LocalGenerators.size(); ++i)
- {
cmMakefile* mf = this->LocalGenerators[i]->GetMakefile();
cmTargets* targets = &(mf->GetTargets());
cmTargets::iterator tit;
@@ -1882,8 +1868,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
const char* name, const char* message,
const cmCustomCommandLines* commandLines,
std::vector<std::string> depends,
- const char* workingDirectory,
- bool depends_on_all /* = false */)
+ const char* workingDirectory)
{
// Package
cmTarget target;
@@ -1898,10 +1883,6 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
workingDirectory);
target.GetPostBuildCommands().push_back(cc);
target.SetProperty("EchoString", message);
- if ( depends_on_all )
- {
- target.AddUtility("all");
- }
std::vector<std::string>::iterator dit;
for ( dit = depends.begin(); dit != depends.end(); ++ dit )
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 2aec19f..6a1aa53 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -16,6 +16,7 @@
#include "cmStandardIncludes.h"
#include "cmTarget.h" // For cmTargets
+#include "cmTargetDepend.h" // For cmTargetDependSet
class cmake;
class cmMakefile;
@@ -38,31 +39,31 @@ public:
///! Free any memory allocated with the GlobalGenerator
cmGlobalGenerator();
virtual ~cmGlobalGenerator();
-
+
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator();
///! Get the name for this generator
virtual const char *GetName() const { return "Generic"; };
-
+
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
+
/**
* Create LocalGenerators and process the CMakeLists files. This does not
- * actually produce any makefiles, DSPs, etc.
+ * actually produce any makefiles, DSPs, etc.
*/
virtual void Configure();
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
- * requests that they Generate.
+ * requests that they Generate.
*/
virtual void Generate();
/**
- * Set/Get and Clear the enabled languages.
+ * Set/Get and Clear the enabled languages.
*/
void SetLanguageEnabled(const char*, cmMakefile* mf);
bool GetLanguageEnabled(const char*) const;
@@ -70,7 +71,7 @@ public:
void GetEnabledLanguages(std::vector<std::string>& lang);
/**
* Try to determine system infomation such as shared library
- * extension, pthreads, byte order etc.
+ * extension, pthreads, byte order etc.
*/
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
@@ -88,7 +89,7 @@ public:
const char *projectName, const char *targetName,
bool fast, std::string *output, cmMakefile* mf);
-
+
/**
* Build a file given the following information. This is a more direct call
* that is used by both CTest and TryCompile. If target name is NULL or
@@ -104,28 +105,28 @@ public:
const char* extraOptions = 0,
std::vector<std::string> const& nativeOptions =
std::vector<std::string>());
-
+
virtual std::string GenerateBuildCommand(
const char* makeProgram,
- const char *projectName, const char* additionalOptions,
+ const char *projectName, const char* additionalOptions,
const char *targetName,
const char* config, bool ignoreErrors, bool fast);
-
+
///! Set the CMake instance
void SetCMakeInstance(cmake *cm);
-
+
///! Get the CMake instance
cmake *GetCMakeInstance() { return this->CMakeInstance; };
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
- const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
+ const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
return this->LocalGenerators;}
- cmLocalGenerator* GetCurrentLocalGenerator()
+ cmLocalGenerator* GetCurrentLocalGenerator()
{return this->CurrentLocalGenerator;}
- void SetCurrentLocalGenerator(cmLocalGenerator* lg)
+ void SetCurrentLocalGenerator(cmLocalGenerator* lg)
{this->CurrentLocalGenerator = lg;}
void AddLocalGenerator(cmLocalGenerator *lg);
@@ -138,11 +139,11 @@ public:
void AddInstallComponent(const char* component);
- const std::set<cmStdString>* GetInstallComponents() const
+ const std::set<cmStdString>* GetInstallComponents() const
{ return &InstallComponents; }
///! Add one installed target to the sets of the exports
- void AddTargetToExports(const char* exportSet, cmTarget* target,
+ void AddTargetToExports(const char* exportSet, cmTarget* target,
cmInstallTargetGenerator* archive,
cmInstallTargetGenerator* runTime,
cmInstallTargetGenerator* library,
@@ -158,10 +159,9 @@ public:
void EnableInstallTarget();
int TryCompileTimeout;
-
+
bool GetForceUnixPaths() {return this->ForceUnixPaths;}
bool GetToolSupportsColor() { return this->ToolSupportsColor; }
- void SetToolSupportsColor(bool enable) { this->ToolSupportsColor = enable; }
///! return the language for the given extension
const char* GetLanguageFromExtension(const char* ext);
@@ -234,7 +234,7 @@ public:
virtual const char* GetCleanTargetName() { return 0; }
// Class to track a set of dependencies.
- class TargetDependSet: public std::set<cmTarget*> {};
+ typedef cmTargetDependSet TargetDependSet;
// what targets does the specified target depend on directly
// via a target_link_libraries or add_dependencies
@@ -254,7 +254,7 @@ public:
bool BinaryDirectoryIsNew(const char* dir)
{
return this->BinaryDirectories.insert(dir).second;
- }
+ }
/** Supported systems creates a GUID for the given name */
virtual void CreateGUID(const char*) {}
@@ -281,7 +281,7 @@ protected:
bool CheckTargets();
- // Fill the ProjectMap, this must be called after LocalGenerators
+ // Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
void FillProjectMap();
void CheckLocalGenerators();
@@ -291,8 +291,7 @@ protected:
void CreateDefaultGlobalTargets(cmTargets* targets);
cmTarget CreateGlobalTarget(const char* name, const char* message,
const cmCustomCommandLines* commandLines,
- std::vector<std::string> depends, const char* workingDir,
- bool depends_on_all = false);
+ std::vector<std::string> depends, const char* workingDir);
bool NeedSymbolicMark;
bool UseLinkScript;
@@ -328,13 +327,13 @@ protected:
private:
float FirstTimeProgress;
// If you add a new map here, make sure it is copied
- // in EnableLanguagesFromGenerator
+ // in EnableLanguagesFromGenerator
std::map<cmStdString, bool> IgnoreExtensions;
std::map<cmStdString, bool> LanguageEnabled;
std::map<cmStdString, cmStdString> OutputExtensions;
std::map<cmStdString, cmStdString> LanguageToOutputExtension;
std::map<cmStdString, cmStdString> ExtensionToLanguage;
- std::map<cmStdString, int> LanguageToLinkerPreference;
+ std::map<cmStdString, int> LanguageToLinkerPreference;
// Record hashes for rules and outputs.
struct RuleHash { char Data[32]; };
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 08eb391..d9a341c 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -24,7 +24,6 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
this->ForceUnixPaths = true;
this->FindMakeProgramFile = "CMakeUnixFindMake.cmake";
this->ToolSupportsColor = true;
- this->ForceVerboseMakefiles = false;
this->NoRuleMessages = false;
#if defined(_WIN32) || defined(__VMS)
@@ -35,8 +34,8 @@ cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3()
}
void cmGlobalUnixMakefileGenerator3
-::EnableLanguage(std::vector<std::string>const& languages,
- cmMakefile *mf,
+::EnableLanguage(std::vector<std::string>const& languages,
+ cmMakefile *mf,
bool optional)
{
this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
@@ -52,17 +51,17 @@ void cmGlobalUnixMakefileGenerator3
std::string langComp = "CMAKE_";
langComp += lang;
langComp += "_COMPILER";
-
+
if(!mf->GetDefinition(langComp.c_str()))
{
if(!optional)
{
- cmSystemTools::Error(langComp.c_str(),
+ cmSystemTools::Error(langComp.c_str(),
" not set, after EnableLanguage");
}
continue;
}
- const char* name = mf->GetRequiredDefinition(langComp.c_str());
+ const char* name = mf->GetRequiredDefinition(langComp.c_str());
if(!cmSystemTools::FileIsFullPath(name))
{
path = cmSystemTools::FindProgram(name);
@@ -71,7 +70,7 @@ void cmGlobalUnixMakefileGenerator3
{
path = name;
}
- if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
+ if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
&& (optional==false))
{
std::string message = "your ";
@@ -97,8 +96,8 @@ void cmGlobalUnixMakefileGenerator3
cmSystemTools::ConvertToUnixSlashes(cnameString);
cmSystemTools::ConvertToUnixSlashes(pathString);
if (cnameString != pathString)
- {
- const char* cvars =
+ {
+ const char* cvars =
this->GetCMakeInstance()->GetProperty(
"__CMAKE_DELETE_CACHE_CHANGE_VARS_");
if(cvars)
@@ -140,7 +139,7 @@ void cmGlobalUnixMakefileGenerator3
}
//----------------------------------------------------------------------------
-void cmGlobalUnixMakefileGenerator3::Generate()
+void cmGlobalUnixMakefileGenerator3::Generate()
{
// first do superclass method
this->cmGlobalGenerator::Generate();
@@ -197,7 +196,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
// Open the output file. This should not be copy-if-different
// because the check-build-system step compares the makefile time to
// see if the build system must be regenerated.
- std::string makefileName =
+ std::string makefileName =
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += cmake::GetCMakeFilesDirectory();
makefileName += "/Makefile2";
@@ -206,11 +205,11 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
{
return;
}
-
+
// get a local generator for some useful methods
- cmLocalUnixMakefileGenerator3 *lg =
+ cmLocalUnixMakefileGenerator3 *lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
-
+
// Write the do not edit header.
lg->WriteDisclaimer(makefileStream);
@@ -239,8 +238,8 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
}
// Write and empty all:
- lg->WriteMakeRule(makefileStream,
- "The main recursive all target", "all",
+ lg->WriteMakeRule(makefileStream,
+ "The main recursive all target", "all",
depends, no_commands, true);
// Write an empty preinstall:
@@ -250,12 +249,12 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2()
// Write out the "special" stuff
lg->WriteSpecialTargetsTop(makefileStream);
-
+
// write the target convenience rules
unsigned int i;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- lg =
+ lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
this->WriteConvenienceRules2(makefileStream,lg);
}
@@ -271,7 +270,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Open the output file. This should not be copy-if-different
// because the check-build-system step compares the makefile time to
// see if the build system must be regenerated.
- std::string cmakefileName =
+ std::string cmakefileName =
this->GetCMakeInstance()->GetHomeOutputDirectory();
cmakefileName += cmake::GetCMakeFilesDirectory();
cmakefileName += "/Makefile.cmake";
@@ -281,14 +280,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
return;
}
- std::string makefileName =
+ std::string makefileName =
this->GetCMakeInstance()->GetHomeOutputDirectory();
makefileName += "/Makefile";
-
+
// get a local generator for some useful methods
- cmLocalUnixMakefileGenerator3 *lg =
+ cmLocalUnixMakefileGenerator3 *lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[0]);
-
+
// Write the do not edit header.
lg->WriteDisclaimer(cmakefileStream);
@@ -301,9 +300,9 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
std::vector<std::string> lfiles;
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
- lg =
+ lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
-
+
// Get the list of files contributing to this generation step.
lfiles.insert(lfiles.end(),lg->GetMakefile()->GetListFiles().begin(),
lg->GetMakefile()->GetListFiles().end());
@@ -311,7 +310,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
// Sort the list and remove duplicates.
std::sort(lfiles.begin(), lfiles.end(), std::less<std::string>());
#if !defined(__VMS) // The Compaq STL on VMS crashes, so accept duplicates.
- std::vector<std::string>::iterator new_end =
+ std::vector<std::string>::iterator new_end =
std::unique(lfiles.begin(),lfiles.end());
lfiles.erase(new_end, lfiles.end());
#endif
@@ -327,14 +326,14 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The top level Makefile was generated from the following files:\n"
<< "SET(CMAKE_MAKEFILE_DEPENDS\n"
- << " \""
+ << " \""
<< lg->Convert(cache.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
for(std::vector<std::string>::const_iterator i = lfiles.begin();
i != lfiles.end(); ++i)
{
cmakefileStream
- << " \""
+ << " \""
<< lg->Convert(i->c_str(), cmLocalGenerator::START_OUTPUT).c_str()
<< "\"\n";
}
@@ -350,10 +349,10 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
cmakefileStream
<< "# The corresponding makefile is:\n"
<< "SET(CMAKE_MAKEFILE_OUTPUTS\n"
- << " \""
+ << " \""
<< lg->Convert(makefileName.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n"
- << " \""
+ << " \""
<< lg->Convert(check.c_str(),
cmLocalGenerator::START_OUTPUT).c_str() << "\"\n";
cmakefileStream << " )\n\n";
@@ -377,19 +376,19 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
std::string tmpStr;
for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
- lg =
+ lg =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
tmpStr = lg->GetMakefile()->GetStartOutputDirectory();
tmpStr += cmake::GetCMakeFilesDirectory();
tmpStr += "/CMakeDirectoryInformation.cmake";
- cmakefileStream << " \"" <<
- lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
+ cmakefileStream << " \"" <<
+ lg->Convert(tmpStr.c_str(),cmLocalGenerator::HOME_OUTPUT).c_str()
<< "\"\n";
}
cmakefileStream << " )\n\n";
}
- this->WriteMainCMakefileLanguageRules(cmakefileStream,
+ this->WriteMainCMakefileLanguageRules(cmakefileStream,
this->LocalGenerators);
}
@@ -468,7 +467,7 @@ cmGlobalUnixMakefileGenerator3
// The directory-level rule should depend on the directory-level
// rules of the subdirectories.
- for(std::vector<cmLocalGenerator*>::iterator sdi =
+ for(std::vector<cmLocalGenerator*>::iterator sdi =
lg->GetChildren().begin(); sdi != lg->GetChildren().end(); ++sdi)
{
cmLocalUnixMakefileGenerator3* slg =
@@ -528,7 +527,7 @@ cmGlobalUnixMakefileGenerator3
std::string cmGlobalUnixMakefileGenerator3
-::GenerateBuildCommand(const char* makeProgram, const char *projectName,
+::GenerateBuildCommand(const char* makeProgram, const char *projectName,
const char* additionalOptions, const char *targetName,
const char* config, bool ignoreErrors, bool fast)
{
@@ -536,9 +535,9 @@ std::string cmGlobalUnixMakefileGenerator3
(void)projectName;
(void)config;
- std::string makeCommand =
+ std::string makeCommand =
cmSystemTools::ConvertToUnixOutputPath(makeProgram);
-
+
// Since we have full control over the invocation of nmake, let us
// make it quiet.
if ( strcmp(this->GetName(), "NMake Makefiles") == 0 )
@@ -573,7 +572,7 @@ std::string cmGlobalUnixMakefileGenerator3
(this->CMakeInstance->GetStartOutputDirectory());
lg->GetMakefile()->MakeStartDirectoriesCurrent();
}
-
+
makeCommand += " \"";
std::string tname = targetName;
if(fast)
@@ -595,14 +594,14 @@ std::string cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void
cmGlobalUnixMakefileGenerator3
-::WriteConvenienceRules(std::ostream& ruleFileStream,
+::WriteConvenienceRules(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted)
{
- std::vector<std::string> depends;
+ std::vector<std::string> depends;
std::vector<std::string> commands;
depends.push_back("cmake_check_build_system");
-
+
// write the target convenience rules
unsigned int i;
cmLocalUnixMakefileGenerator3 *lg;
@@ -632,7 +631,7 @@ cmGlobalUnixMakefileGenerator3
ruleFileStream
<< "# Target rules for targets named "
<< t->second.GetName() << "\n\n";
-
+
// Write the rule.
commands.clear();
std::string tmp = cmake::GetCMakeFilesDirectoryPostSlash();
@@ -641,16 +640,16 @@ cmGlobalUnixMakefileGenerator3
(tmp.c_str(),t->second.GetName()));
depends.clear();
depends.push_back("cmake_check_build_system");
- lg->WriteMakeRule(ruleFileStream,
+ lg->WriteMakeRule(ruleFileStream,
"Build rule for target.",
t->second.GetName(), depends, commands,
true);
-
+
// Add a fast rule to build the target
std::string localName = lg->GetRelativeTargetDirectory(t->second);
std::string makefileName;
makefileName = localName;
- makefileName += "/build.make";
+ makefileName += "/build.make";
depends.clear();
commands.clear();
std::string makeTargetName = localName;
@@ -687,10 +686,10 @@ cmGlobalUnixMakefileGenerator3
//----------------------------------------------------------------------------
void
cmGlobalUnixMakefileGenerator3
-::WriteConvenienceRules2(std::ostream& ruleFileStream,
+::WriteConvenienceRules2(std::ostream& ruleFileStream,
cmLocalUnixMakefileGenerator3 *lg)
{
- std::vector<std::string> depends;
+ std::vector<std::string> depends;
std::vector<std::string> commands;
std::string localName;
std::string makeTargetName;
@@ -698,7 +697,7 @@ cmGlobalUnixMakefileGenerator3
// write the directory level rules for this local gen
this->WriteDirectoryRules2(ruleFileStream,lg);
-
+
depends.push_back("cmake_check_build_system");
// for each target Generate the rule files for each target.
@@ -718,15 +717,15 @@ cmGlobalUnixMakefileGenerator3
localName = lg->GetRelativeTargetDirectory(t->second);
makefileName = localName;
makefileName += "/build.make";
-
+
bool needRequiresStep = this->NeedRequiresStep(t->second);
-
+
lg->WriteDivider(ruleFileStream);
ruleFileStream
<< "# Target rules for target "
<< localName << "\n\n";
-
- commands.clear();
+
+ commands.clear();
makeTargetName = localName;
makeTargetName += "/depend";
commands.push_back(lg->GetRecursiveMakeCall
@@ -744,7 +743,7 @@ cmGlobalUnixMakefileGenerator3
makeTargetName += "/build";
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(),makeTargetName.c_str()));
-
+
// Write the rule.
localName += "/all";
depends.clear();
@@ -780,7 +779,7 @@ cmGlobalUnixMakefileGenerator3
this->AppendGlobalTargetDepends(depends,t->second);
lg->WriteMakeRule(ruleFileStream, "All Build rule for target.",
localName.c_str(), depends, commands, true);
-
+
// add the all/all dependency
if(!this->IsExcluded(this->LocalGenerators[0], t->second))
{
@@ -831,17 +830,17 @@ cmGlobalUnixMakefileGenerator3
depends.push_back("cmake_check_build_system");
localName = lg->GetRelativeTargetDirectory(t->second);
localName += "/rule";
- lg->WriteMakeRule(ruleFileStream,
+ lg->WriteMakeRule(ruleFileStream,
"Build rule for subdir invocation for target.",
localName.c_str(), depends, commands, true);
-
+
// Add a target with the canonical name (no prefix, suffix or path).
commands.clear();
depends.clear();
depends.push_back(localName);
lg->WriteMakeRule(ruleFileStream, "Convenience name for target.",
t->second.GetName(), depends, commands, true);
-
+
// Add rules to prepare the target for installation.
if(t->second.NeedRelinkBeforeInstall(lg->ConfigurationName.c_str()))
{
@@ -851,7 +850,7 @@ cmGlobalUnixMakefileGenerator3
commands.clear();
commands.push_back(lg->GetRecursiveMakeCall
(makefileName.c_str(), localName.c_str()));
- lg->WriteMakeRule(ruleFileStream,
+ lg->WriteMakeRule(ruleFileStream,
"Pre-install relink rule for target.",
localName.c_str(), depends, commands, true);
@@ -864,7 +863,7 @@ cmGlobalUnixMakefileGenerator3
"preinstall", depends, commands, true);
}
}
-
+
// add the clean rule
localName = lg->GetRelativeTargetDirectory(t->second);
makeTargetName = localName;
@@ -1005,7 +1004,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
lg->AppendEcho(commands,"... all (the default if no target is provided)");
lg->AppendEcho(commands,"... clean");
lg->AppendEcho(commands,"... depend");
-
+
// Keep track of targets already listed.
std::set<cmStdString> emittedTargets;
@@ -1014,7 +1013,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule
cmLocalUnixMakefileGenerator3 *lg2;
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
- lg2 =
+ lg2 =
static_cast<cmLocalUnixMakefileGenerator3 *>(this->LocalGenerators[i]);
// for the passed in makefile or if this is the top Makefile wripte out
// the targets
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index 01f5fac..cdc9460 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -22,19 +22,19 @@ class cmLocalUnixMakefileGenerator3;
* \brief Write a Unix makefiles.
*
* cmGlobalUnixMakefileGenerator3 manages UNIX build process for a tree
-
-
+
+
The basic approach of this generator is to produce Makefiles that will all
be run with the current working directory set to the Home Output
directory. The one exception to this is the subdirectory Makefiles which are
created as a convenience and just cd up to the Home Output directory and
- invoke the main Makefiles.
-
+ invoke the main Makefiles.
+
The make process starts with Makefile. Makefile should only contain the
targets the user is likely to invoke directly from a make command line. No
internal targets should be in this file. Makefile2 contains the internal
targets that are required to make the process work.
-
+
Makefile2 in turn will recursively make targets in the correct order. Each
target has its own directory <target>.dir and its own makefile build.make in
that directory. Also in that directory is a couple makefiles per source file
@@ -47,7 +47,7 @@ class cmLocalUnixMakefileGenerator3;
rescanned.
Rules for custom commands follow the same model as rules for source files.
-
+
*/
class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
@@ -64,13 +64,13 @@ public:
/** Get the documentation entry for this generator. */
virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
+
///! Create a local generator appropriate to this Global Generator3
virtual cmLocalGenerator *CreateLocalGenerator();
/**
* Try to determine system infomation such as shared library
- * extension, pthreads, byte order etc.
+ * extension, pthreads, byte order etc.
*/
virtual void EnableLanguage(std::vector<std::string>const& languages,
cmMakefile *, bool optional);
@@ -78,11 +78,11 @@ public:
/**
* Generate the all required files for building this project/tree. This
* basically creates a series of LocalGenerators for each directory and
- * requests that they Generate.
+ * requests that they Generate.
*/
virtual void Generate();
-
-
+
+
void WriteMainCMakefileLanguageRules(cmGeneratedFileStream& cmakefileStream,
std::vector<cmLocalGenerator *> &);
@@ -91,7 +91,7 @@ public:
cmLocalUnixMakefileGenerator3 *);
// write the top lvel target rules
- void WriteConvenienceRules(std::ostream& ruleFileStream,
+ void WriteConvenienceRules(std::ostream& ruleFileStream,
std::set<cmStdString> &emitted);
/** Get the command to use for a target that has no rule. This is
@@ -105,23 +105,13 @@ public:
// change the build command for speed
virtual std::string GenerateBuildCommand
(const char* makeProgram,
- const char *projectName, const char* additionalOptions,
+ const char *projectName, const char* additionalOptions,
const char *targetName,
const char* config, bool ignoreErrors, bool fast);
/** Record per-target progress information. */
void RecordTargetProgress(cmMakefileTargetGenerator* tg);
- /**
- * If true, the CMake variable CMAKE_VERBOSE_MAKEFILES doesn't have effect
- * anymore. Set it to true when writing a generator where short output
- * doesn't make sense, e.g. because the full output is parsed by an
- * IDE/editor.
- */
- bool GetForceVerboseMakefiles() { return this->ForceVerboseMakefiles; }
- void SetForceVerboseMakefiles(bool enable)
- {this->ForceVerboseMakefiles=enable;}
-
protected:
void WriteMainMakefile2();
void WriteMainCMakefile();
@@ -169,7 +159,6 @@ protected:
// in the rule to satisfy the make program.
std::string EmptyRuleHackCommand;
- bool ForceVerboseMakefiles;
bool NoRuleMessages;
// Store per-target progress counters.
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 403507f..0b939af 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -19,6 +19,10 @@
cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator()
{
this->FindMakeProgramFile = "CMakeVS10FindMake.cmake";
+ std::string vc10Express;
+ this->ExpressEdition = cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
+ "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
}
//----------------------------------------------------------------------------
@@ -63,6 +67,16 @@ void cmGlobalVisualStudio10Generator
}
//----------------------------------------------------------------------------
+const char* cmGlobalVisualStudio10Generator::GetPlatformToolset()
+{
+ if(!this->PlatformToolset.empty())
+ {
+ return this->PlatformToolset.c_str();
+ }
+ return 0;
+}
+
+//----------------------------------------------------------------------------
std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory()
{
std::string base;
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 219c36e..bef5642 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -54,6 +54,12 @@ public:
cmMakefile *, bool optional);
virtual void WriteSLNHeader(std::ostream& fout);
+ /** Is the installed VS an Express edition? */
+ bool IsExpressEdition() const { return this->ExpressEdition; }
+
+ /** The toolset name for the target platform. */
+ const char* GetPlatformToolset();
+
/**
* Where does this version of Visual Studio look for macros for the
* current user? Returns the empty string if this version of Visual
@@ -70,5 +76,9 @@ public:
{ return "$(Configuration)";}
protected:
virtual const char* GetIDEVersion() { return "10.0"; }
+
+ std::string PlatformToolset;
+private:
+ bool ExpressEdition;
};
#endif
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx
index 109b60d..8600777 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx
@@ -36,3 +36,52 @@ void cmGlobalVisualStudio10Win64Generator
mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64");
mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64");
}
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio10Win64Generator::Find64BitTools(cmMakefile* mf)
+{
+ if(!this->PlatformToolset.empty())
+ {
+ return true;
+ }
+ // This edition does not come with 64-bit tools. Look for them.
+ //
+ // TODO: Detect available tools? x64\v100 exists but does not work?
+ // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath
+ // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/
+ // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK}
+ std::string winSDK_7_1;
+ if(cmSystemTools::ReadRegistryValue(
+ "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\"
+ "Windows\\v7.1;InstallationFolder", winSDK_7_1))
+ {
+ cmOStringStream m;
+ m << "Found Windows SDK v7.1: " << winSDK_7_1;
+ mf->DisplayStatus(m.str().c_str(), -1);
+ this->PlatformToolset = "Windows7.1SDK";
+ return true;
+ }
+ else
+ {
+ cmOStringStream e;
+ e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n"
+ << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n"
+ << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str());
+ cmSystemTools::SetFatalErrorOccured();
+ return false;
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10Win64Generator
+::EnableLanguage(std::vector<std::string> const& languages,
+ cmMakefile* mf, bool optional)
+{
+ if(this->IsExpressEdition() && !this->Find64BitTools(mf))
+ {
+ return;
+ }
+ this->cmGlobalVisualStudio10Generator
+ ::EnableLanguage(languages, mf, optional);
+}
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
index 39c9d08..e6d3dc5 100644
--- a/Source/cmGlobalVisualStudio10Win64Generator.h
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -34,5 +34,8 @@ public:
virtual void AddPlatformDefinitions(cmMakefile* mf);
+ bool Find64BitTools(cmMakefile* mf);
+ virtual void EnableLanguage(std::vector<std::string>const& languages,
+ cmMakefile *, bool optional);
};
#endif
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 203ca77..fe44e20 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -197,8 +197,6 @@ void cmGlobalVisualStudio6Generator
this->GetTargetSets(projectTargets, originalTargets, root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets);
- std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
- rootdir += "/";
for(OrderedTargetDependSet::const_iterator
tt = orderedProjectTargets.begin();
tt != orderedProjectTargets.end(); ++tt)
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index ba18687..2874952 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -110,7 +110,7 @@ void cmGlobalVisualStudio71Generator
this->GetTargetSets(projectTargets, originalTargets, root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets);
- this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
+ this->WriteTargetsToSolution(fout, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 2b9e5ba..eb84a2c 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -270,15 +270,14 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::ostream& fout,
- cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets)
{
- std::string rootdir = root->GetMakefile()->GetStartOutputDirectory();
- rootdir += "/";
for(OrderedTargetDependSet::const_iterator tt =
projectTargets.begin(); tt != projectTargets.end(); ++tt)
{
cmTarget* target = *tt;
+ bool written = false;
+
// handle external vc project files
const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
if(expath)
@@ -287,6 +286,7 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
std::string location = expath;
this->WriteExternalProject(fout, project.c_str(),
location.c_str(), target->GetUtilities());
+ written = true;
}
else
{
@@ -296,51 +296,50 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
{
cmMakefile* tmf = target->GetMakefile();
std::string dir = tmf->GetStartOutputDirectory();
- dir = root->Convert(dir.c_str(),
- cmLocalGenerator::START_OUTPUT);
this->WriteProject(fout, vcprojName, dir.c_str(),
*target);
+ written = true;
+ }
+ }
- // Create "solution folder" information from FOLDER target property
- //
- if (this->UseFolderProperty())
+ // Create "solution folder" information from FOLDER target property
+ //
+ if (written && this->UseFolderProperty())
+ {
+ const char *targetFolder = target->GetProperty("FOLDER");
+ if (targetFolder)
+ {
+ std::vector<cmsys::String> tokens =
+ cmSystemTools::SplitString(targetFolder, '/', false);
+
+ std::string cumulativePath = "";
+
+ for(std::vector<cmsys::String>::iterator iter = tokens.begin();
+ iter != tokens.end(); ++iter)
{
- const char *targetFolder = target->GetProperty("FOLDER");
- if (targetFolder)
+ if(!iter->size())
{
- std::vector<cmsys::String> tokens =
- cmSystemTools::SplitString(targetFolder, '/', false);
-
- std::string cumulativePath = "";
-
- for(std::vector<cmsys::String>::iterator iter = tokens.begin();
- iter != tokens.end(); ++iter)
- {
- if(!iter->size())
- {
- continue;
- }
-
- if (cumulativePath.empty())
- {
- cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
- }
- else
- {
- VisualStudioFolders[cumulativePath].insert(
- cumulativePath + "/" + *iter);
-
- cumulativePath = cumulativePath + "/" + *iter;
- }
-
- this->CreateGUID(cumulativePath.c_str());
- }
-
- if (!cumulativePath.empty())
- {
- VisualStudioFolders[cumulativePath].insert(target->GetName());
- }
+ continue;
}
+
+ if (cumulativePath.empty())
+ {
+ cumulativePath = "CMAKE_FOLDER_GUID_" + *iter;
+ }
+ else
+ {
+ VisualStudioFolders[cumulativePath].insert(
+ cumulativePath + "/" + *iter);
+
+ cumulativePath = cumulativePath + "/" + *iter;
+ }
+
+ this->CreateGUID(cumulativePath.c_str());
+ }
+
+ if (!cumulativePath.empty())
+ {
+ VisualStudioFolders[cumulativePath].insert(target->GetName());
}
}
}
@@ -386,7 +385,7 @@ void cmGlobalVisualStudio7Generator
this->GetTargetSets(projectTargets, originalTargets, root, generators);
OrderedTargetDependSet orderedProjectTargets(projectTargets);
- this->WriteTargetsToSolution(fout, root, orderedProjectTargets);
+ this->WriteTargetsToSolution(fout, orderedProjectTargets);
bool useFolderProperty = this->UseFolderProperty();
if (useFolderProperty)
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index b6c84e8..57c079d 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -118,7 +118,6 @@ protected:
virtual void WriteTargetsToSolution(
std::ostream& fout,
- cmLocalGenerator* root,
OrderedTargetDependSet const& projectTargets);
virtual void WriteTargetDepends(
std::ostream& fout,
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 7c65c32..2d080df 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -289,6 +289,28 @@ cmGlobalVisualStudio8Generator
}
//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio8Generator::ComputeTargetDepends()
+{
+ // Skip over the cmGlobalVisualStudioGenerator implementation!
+ // We do not need the support that VS <= 7.1 needs.
+ return this->cmGlobalGenerator::ComputeTargetDepends();
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio8Generator::WriteProjectDepends(
+ std::ostream& fout, const char*, const char*, cmTarget& t)
+{
+ TargetDependSet const& unordered = this->GetTargetDirectDepends(t);
+ OrderedTargetDependSet depends(unordered);
+ for(OrderedTargetDependSet::const_iterator i = depends.begin();
+ i != depends.end(); ++i)
+ {
+ std::string guid = this->GetGUID((*i)->GetName());
+ fout << "\t\t{" << guid << "} = {" << guid << "}\n";
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
cmTarget& target)
{
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index e0d5d80..e0913ed 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -78,6 +78,9 @@ protected:
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
bool partOfDefaultBuild);
+ virtual bool ComputeTargetDepends();
+ virtual void WriteProjectDepends(std::ostream& fout, const char* name,
+ const char* path, cmTarget &t);
const char* ArchitectureId;
};
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index bae18a3..7696e6c 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -237,6 +237,59 @@ std::string cmGlobalVisualStudioGenerator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
+void cmGlobalVisualStudioGenerator::FillLinkClosure(cmTarget* target,
+ TargetSet& linked)
+{
+ if(linked.insert(target).second)
+ {
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ for(TargetDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
+ {
+ if(di->IsLink())
+ {
+ this->FillLinkClosure(*di, linked);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudioGenerator::TargetSet const&
+cmGlobalVisualStudioGenerator::GetTargetLinkClosure(cmTarget* target)
+{
+ TargetSetMap::iterator i = this->TargetLinkClosure.find(target);
+ if(i == this->TargetLinkClosure.end())
+ {
+ TargetSetMap::value_type entry(target, TargetSet());
+ i = this->TargetLinkClosure.insert(entry).first;
+ this->FillLinkClosure(target, i->second);
+ }
+ return i->second;
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudioGenerator::FollowLinkDepends(
+ cmTarget* target, std::set<cmTarget*>& linked)
+{
+ if(linked.insert(target).second &&
+ target->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ // Static library targets do not list their link dependencies so
+ // we must follow them transitively now.
+ TargetDependSet const& depends = this->GetTargetDirectDepends(*target);
+ for(TargetDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
+ {
+ if(di->IsLink())
+ {
+ this->FollowLinkDepends(*di, linked);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
bool cmGlobalVisualStudioGenerator::ComputeTargetDepends()
{
if(!this->cmGlobalGenerator::ComputeTargetDepends())
@@ -269,51 +322,94 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target)
return;
}
VSDependSet& vsTargetDepend = this->VSTargetDepends[&target];
+ // VS <= 7.1 has two behaviors that affect solution dependencies.
+ //
+ // (1) Solution-level dependencies between a linkable target and a
+ // library cause that library to be linked. We use an intermedite
+ // empty utility target to express the dependency. (VS 8 and above
+ // provide a project file "LinkLibraryDependencies" setting to
+ // choose whether to activate this behavior. We disable it except
+ // when linking external project files.)
+ //
+ // (2) We cannot let static libraries depend directly on targets to
+ // which they "link" because the librarian tool will copy the
+ // targets into the static library. While the work-around for
+ // behavior (1) would also avoid this, it would create a large
+ // number of extra utility targets for little gain. Instead, use
+ // the above work-around only for dependencies explicitly added by
+ // the add_dependencies() command. Approximate link dependencies by
+ // leaving them out for the static library itself but following them
+ // transitively for other targets.
+
+ bool allowLinkable = (target.GetType() != cmTarget::STATIC_LIBRARY &&
+ target.GetType() != cmTarget::SHARED_LIBRARY &&
+ target.GetType() != cmTarget::MODULE_LIBRARY &&
+ target.GetType() != cmTarget::EXECUTABLE);
+
+ TargetDependSet const& depends = this->GetTargetDirectDepends(target);
+
+ // Collect implicit link dependencies (target_link_libraries).
+ // Static libraries cannot depend on their link implementation
+ // due to behavior (2), but they do not really need to.
+ std::set<cmTarget*> linkDepends;
if(target.GetType() != cmTarget::STATIC_LIBRARY)
{
- cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator j = libs.begin();
- j != libs.end(); ++j)
+ for(TargetDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
{
- if(j->first != target.GetName() &&
- this->FindTarget(0, j->first.c_str()))
+ cmTargetDepend dep = *di;
+ if(dep.IsLink())
{
- vsTargetDepend.insert(j->first);
+ this->FollowLinkDepends(dep, linkDepends);
}
}
}
- std::set<cmStdString> const& utils = target.GetUtilities();
- for(std::set<cmStdString>::const_iterator i = utils.begin();
- i != utils.end(); ++i)
+
+ // Collext explicit util dependencies (add_dependencies).
+ std::set<cmTarget*> utilDepends;
+ for(TargetDependSet::const_iterator di = depends.begin();
+ di != depends.end(); ++di)
{
- if(*i != target.GetName())
+ cmTargetDepend dep = *di;
+ if(dep.IsUtil())
{
- std::string name = this->GetUtilityForTarget(target, i->c_str());
- vsTargetDepend.insert(name);
+ this->FollowLinkDepends(dep, utilDepends);
}
}
-}
-//----------------------------------------------------------------------------
-bool cmGlobalVisualStudioGenerator::CheckTargetLinks(cmTarget& target,
- const char* name)
-{
- // Return whether the given target links to a target with the given name.
- if(target.GetType() == cmTarget::STATIC_LIBRARY)
+ // Collect all targets linked by this target so we can avoid
+ // intermediate targets below.
+ TargetSet linked;
+ if(target.GetType() != cmTarget::STATIC_LIBRARY)
{
- // Static libraries never link to anything.
- return false;
+ linked = this->GetTargetLinkClosure(&target);
}
- cmTarget::LinkLibraryVectorType const& libs = target.GetLinkLibraries();
- for(cmTarget::LinkLibraryVectorType::const_iterator i = libs.begin();
- i != libs.end(); ++i)
+
+ // Emit link dependencies.
+ for(std::set<cmTarget*>::iterator di = linkDepends.begin();
+ di != linkDepends.end(); ++di)
+ {
+ cmTarget* dep = *di;
+ vsTargetDepend.insert(dep->GetName());
+ }
+
+ // Emit util dependencies. Possibly use intermediate targets.
+ for(std::set<cmTarget*>::iterator di = utilDepends.begin();
+ di != utilDepends.end(); ++di)
{
- if(i->first == name)
+ cmTarget* dep = *di;
+ if(allowLinkable || !dep->IsLinkable() || linked.count(dep))
{
- return true;
+ // Direct dependency allowed.
+ vsTargetDepend.insert(dep->GetName());
+ }
+ else
+ {
+ // Direct dependency on linkable target not allowed.
+ // Use an intermediate utility target.
+ vsTargetDepend.insert(this->GetUtilityDepend(dep));
}
}
- return false;
}
//----------------------------------------------------------------------------
@@ -330,45 +426,6 @@ std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target)
}
//----------------------------------------------------------------------------
-std::string
-cmGlobalVisualStudioGenerator::GetUtilityForTarget(cmTarget& target,
- const char* name)
-{
- if(!this->VSLinksDependencies())
- {
- return name;
- }
-
- // Possibly depend on an intermediate utility target to avoid
- // linking.
- if(target.GetType() == cmTarget::STATIC_LIBRARY ||
- target.GetType() == cmTarget::SHARED_LIBRARY ||
- target.GetType() == cmTarget::MODULE_LIBRARY ||
- target.GetType() == cmTarget::EXECUTABLE)
- {
- // The depender is a target that links.
- if(cmTarget* depTarget = this->FindTarget(0, name))
- {
- if(depTarget->GetType() == cmTarget::STATIC_LIBRARY ||
- depTarget->GetType() == cmTarget::SHARED_LIBRARY ||
- depTarget->GetType() == cmTarget::MODULE_LIBRARY)
- {
- // This utility dependency will cause an attempt to link. If
- // the depender does not already link the dependee we need an
- // intermediate target.
- if(!this->CheckTargetLinks(target, name))
- {
- return this->GetUtilityDepend(depTarget);
- }
- }
- }
- }
-
- // No special case. Just use the original dependency name.
- return name;
-}
-
-//----------------------------------------------------------------------------
#include <windows.h>
//----------------------------------------------------------------------------
@@ -706,11 +763,22 @@ cmGlobalVisualStudioGenerator::TargetCompare
//----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet
-::OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const& targets)
+::OrderedTargetDependSet(TargetDependSet const& targets)
{
- for(cmGlobalGenerator::TargetDependSet::const_iterator ti =
+ for(TargetDependSet::const_iterator ti =
targets.begin(); ti != targets.end(); ++ti)
{
this->insert(*ti);
}
}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudioGenerator::OrderedTargetDependSet
+::OrderedTargetDependSet(TargetSet const& targets)
+{
+ for(TargetSet::const_iterator ti = targets.begin();
+ ti != targets.end(); ++ti)
+ {
+ this->insert(*ti);
+ }
+}
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index c8ea339..bc96f4e 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -69,15 +69,12 @@ public:
i.e. "Can I build Debug and Release in the same tree?" */
virtual bool IsMultiConfig() { return true; }
+ class TargetSet: public std::set<cmTarget*> {};
struct TargetCompare
{
bool operator()(cmTarget const* l, cmTarget const* r) const;
};
- class OrderedTargetDependSet: public std::multiset<cmTarget*, TargetCompare>
- {
- public:
- OrderedTargetDependSet(cmGlobalGenerator::TargetDependSet const&);
- };
+ class OrderedTargetDependSet;
protected:
// Does this VS version link targets to each other if there are
@@ -99,6 +96,24 @@ protected:
std::string GetUtilityDepend(cmTarget* target);
typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
UtilityDependsMap UtilityDepends;
+private:
+ void FollowLinkDepends(cmTarget* target, std::set<cmTarget*>& linked);
+
+ class TargetSetMap: public std::map<cmTarget*, TargetSet> {};
+ TargetSetMap TargetLinkClosure;
+ void FillLinkClosure(cmTarget* target, TargetSet& linked);
+ TargetSet const& GetTargetLinkClosure(cmTarget* target);
+};
+
+class cmGlobalVisualStudioGenerator::OrderedTargetDependSet:
+ public std::multiset<cmTargetDepend,
+ cmGlobalVisualStudioGenerator::TargetCompare>
+{
+public:
+ typedef cmGlobalGenerator::TargetDependSet TargetDependSet;
+ typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet;
+ OrderedTargetDependSet(TargetDependSet const&);
+ OrderedTargetDependSet(TargetSet const&);
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2f7bc44..29c2d06 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1334,11 +1334,13 @@ void cmGlobalXCodeGenerator
cc.GetDepends().begin();
d != cc.GetDepends().end(); ++d)
{
- std::string dep =
- this->CurrentLocalGenerator->GetRealDependency(d->c_str(),
- configName);
- makefileStream << "\\\n" << this
- ->ConvertToRelativeForMake(dep.c_str());
+ std::string dep;
+ if(this->CurrentLocalGenerator
+ ->GetRealDependency(d->c_str(), configName, dep))
+ {
+ makefileStream << "\\\n" <<
+ this->ConvertToRelativeForMake(dep.c_str());
+ }
}
makefileStream << "\n";
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
new file mode 100644
index 0000000..bdb33bc
--- /dev/null
+++ b/Source/cmGraphVizWriter.cxx
@@ -0,0 +1,435 @@
+/*============================================================================
+ 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 "cmGraphVizWriter.h"
+#include "cmMakefile.h"
+#include "cmLocalGenerator.h"
+#include "cmGlobalGenerator.h"
+#include "cmGeneratedFileStream.h"
+
+#include <memory>
+
+
+
+static const char* getShapeForTarget(const cmTarget* target)
+{
+ if (!target)
+ {
+ return "ellipse";
+ }
+
+ switch ( target->GetType() )
+ {
+ case cmTarget::EXECUTABLE:
+ return "house";
+ case cmTarget::STATIC_LIBRARY:
+ return "diamond";
+ case cmTarget::SHARED_LIBRARY:
+ return "polygon";
+ case cmTarget::MODULE_LIBRARY:
+ return "octagon";
+ default:
+ break;
+ }
+
+ return "box";
+}
+
+
+cmGraphVizWriter::cmGraphVizWriter(const std::vector<cmLocalGenerator*>&
+ localGenerators)
+:GraphType("digraph")
+,GraphName("GG")
+,GraphHeader("node [\n fontsize = \"12\"\n];")
+,GraphNodePrefix("node")
+,GenerateForExecutables(true)
+,GenerateForStaticLibs(true)
+,GenerateForSharedLibs(true)
+,GenerateForModuleLibs(true)
+,LocalGenerators(localGenerators)
+,HaveTargetsAndLibs(false)
+{
+}
+
+
+void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
+ const char* fallbackSettingsFileName)
+{
+ cmake cm;
+ cmGlobalGenerator ggi;
+ ggi.SetCMakeInstance(&cm);
+ std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
+ cmMakefile *mf = lg->GetMakefile();
+
+ const char* inFileName = settingsFileName;
+
+ if ( !cmSystemTools::FileExists(inFileName) )
+ {
+ inFileName = fallbackSettingsFileName;
+ if ( !cmSystemTools::FileExists(inFileName) )
+ {
+ return;
+ }
+ }
+
+ if ( !mf->ReadListFile(0, inFileName) )
+ {
+ cmSystemTools::Error("Problem opening GraphViz options file: ",
+ inFileName);
+ return;
+ }
+
+ std::cout << "Reading GraphViz options file: " << inFileName << std::endl;
+
+#define __set_if_set(var, cmakeDefinition) \
+ { \
+ const char* value = mf->GetDefinition(cmakeDefinition); \
+ if ( value ) \
+ { \
+ var = value; \
+ } \
+ }
+
+ __set_if_set(this->GraphType, "GRAPHVIZ_GRAPH_TYPE");
+ __set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME");
+ __set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER");
+ __set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX");
+
+#define __set_bool_if_set(var, cmakeDefinition) \
+ { \
+ const char* value = mf->GetDefinition(cmakeDefinition); \
+ if ( value ) \
+ { \
+ var = mf->IsOn(cmakeDefinition); \
+ } \
+ }
+
+ __set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES");
+ __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS");
+ __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS");
+ __set_bool_if_set(this->GenerateForModuleLibs , "GRAPHVIZ_MODULE_LIBS");
+
+ cmStdString tmpRegexString;
+ __set_if_set(tmpRegexString, "GRAPHVIZ_TARGET_IGNORE_REGEX");
+ if (tmpRegexString.size() > 0)
+ {
+ if (!this->TargetIgnoreRegex.compile(tmpRegexString.c_str()))
+ {
+ std::cerr << "Could not compile bad regex \"" << tmpRegexString << "\""
+ << std::endl;
+ }
+ }
+
+ this->TargetsToIgnore.clear();
+ const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
+ if ( ignoreTargets )
+ {
+ std::vector<std::string> ignoreTargetsVector;
+ cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
+ for(std::vector<std::string>::iterator itvIt = ignoreTargetsVector.begin();
+ itvIt != ignoreTargetsVector.end();
+ ++ itvIt )
+ {
+ this->TargetsToIgnore.insert(itvIt->c_str());
+ }
+ }
+
+}
+
+
+void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
+{
+ this->CollectTargetsAndLibs();
+
+ for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ this->TargetPtrs.begin();
+ ptrIt != this->TargetPtrs.end();
+ ++ptrIt)
+ {
+ if (ptrIt->second == NULL)
+ {
+ continue;
+ }
+
+ if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
+ {
+ continue;
+ }
+
+ std::set<std::string> insertedConnections;
+ std::set<std::string> insertedNodes;
+
+ std::string currentFilename = fileName;
+ currentFilename += ".";
+ currentFilename += ptrIt->first;
+ cmGeneratedFileStream str(currentFilename.c_str());
+ if ( !str )
+ {
+ return;
+ }
+
+ std::cout << "Writing " << currentFilename << "..." << std::endl;
+ this->WriteHeader(str);
+
+ this->WriteConnections(ptrIt->first.c_str(),
+ insertedNodes, insertedConnections, str);
+ this->WriteFooter(str);
+ }
+
+}
+
+
+void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
+{
+ this->CollectTargetsAndLibs();
+
+ cmGeneratedFileStream str(fileName);
+ if ( !str )
+ {
+ return;
+ }
+ this->WriteHeader(str);
+
+ std::cout << "Writing " << fileName << "..." << std::endl;
+
+ std::set<std::string> insertedConnections;
+ std::set<std::string> insertedNodes;
+
+ for(std::map<cmStdString, const cmTarget*>::const_iterator ptrIt =
+ this->TargetPtrs.begin();
+ ptrIt != this->TargetPtrs.end();
+ ++ptrIt)
+ {
+ if (ptrIt->second == NULL)
+ {
+ continue;
+ }
+
+ if (this->GenerateForTargetType(ptrIt->second->GetType()) == false)
+ {
+ continue;
+ }
+
+ this->WriteConnections(ptrIt->first.c_str(),
+ insertedNodes, insertedConnections, str);
+ }
+ this->WriteFooter(str);
+}
+
+
+void cmGraphVizWriter::WriteHeader(cmGeneratedFileStream& str) const
+{
+ str << this->GraphType << " " << this->GraphName << " {" << std::endl;
+ str << this->GraphHeader << std::endl;
+}
+
+
+void cmGraphVizWriter::WriteFooter(cmGeneratedFileStream& str) const
+{
+ str << "}" << std::endl;
+}
+
+
+void cmGraphVizWriter::WriteConnections(const char* targetName,
+ std::set<std::string>& insertedNodes,
+ std::set<std::string>& insertedConnections,
+ cmGeneratedFileStream& str) const
+{
+ std::map<cmStdString, const cmTarget* >::const_iterator targetPtrIt =
+ this->TargetPtrs.find(targetName);
+
+ if (targetPtrIt == this->TargetPtrs.end()) // not found at all
+ {
+ return;
+ }
+
+ this->WriteNode(targetName, targetPtrIt->second, insertedNodes, str);
+
+ if (targetPtrIt->second == NULL) // it's an external library
+ {
+ return;
+ }
+
+
+ std::string myNodeName = this->TargetNamesNodes.find(targetName)->second;
+
+ const cmTarget::LinkLibraryVectorType* ll =
+ &(targetPtrIt->second->GetOriginalLinkLibraries());
+
+ for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
+ llit != ll->end();
+ ++ llit )
+ {
+ const char* libName = llit->first.c_str();
+ std::map<cmStdString, cmStdString>::const_iterator libNameIt =
+ this->TargetNamesNodes.find(libName);
+
+ std::string connectionName = myNodeName;
+ connectionName += "-";
+ connectionName += libNameIt->second;
+ if (insertedConnections.find(connectionName) == insertedConnections.end())
+ {
+ insertedConnections.insert(connectionName);
+ this->WriteNode(libName, this->TargetPtrs.find(libName)->second,
+ insertedNodes, str);
+
+ str << " \"" << myNodeName.c_str() << "\" -> \""
+ << libNameIt->second.c_str() << "\"";
+ str << " // " << targetName << " -> " << libName << std::endl;
+ this->WriteConnections(libName, insertedNodes, insertedConnections, str);
+ }
+ }
+
+}
+
+
+void cmGraphVizWriter::WriteNode(const char* targetName,
+ const cmTarget* target,
+ std::set<std::string>& insertedNodes,
+ cmGeneratedFileStream& str) const
+{
+ if (insertedNodes.find(targetName) == insertedNodes.end())
+ {
+ insertedNodes.insert(targetName);
+ std::map<cmStdString, cmStdString>::const_iterator nameIt =
+ this->TargetNamesNodes.find(targetName);
+
+ str << " \"" << nameIt->second.c_str() << "\" [ label=\""
+ << targetName << "\" shape=\"" << getShapeForTarget(target)
+ << "\"];" << std::endl;
+ }
+}
+
+
+void cmGraphVizWriter::CollectTargetsAndLibs()
+{
+ if (this->HaveTargetsAndLibs == false)
+ {
+ this->HaveTargetsAndLibs = true;
+ int cnt = this->CollectAllTargets();
+ this->CollectAllExternalLibs(cnt);
+ }
+}
+
+
+int cmGraphVizWriter::CollectAllTargets()
+{
+ int cnt = 0;
+ // First pass get the list of all cmake targets
+ for (std::vector<cmLocalGenerator*>::const_iterator lit =
+ this->LocalGenerators.begin();
+ lit != this->LocalGenerators.end();
+ ++ lit )
+ {
+ const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
+ for ( cmTargets::const_iterator tit = targets->begin();
+ tit != targets->end();
+ ++ tit )
+ {
+ const char* realTargetName = tit->first.c_str();
+ if(this->IgnoreThisTarget(realTargetName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+ //std::cout << "Found target: " << tit->first.c_str() << std::endl;
+ cmOStringStream ostr;
+ ostr << this->GraphNodePrefix << cnt++;
+ this->TargetNamesNodes[realTargetName] = ostr.str();
+ this->TargetPtrs[realTargetName] = &tit->second;
+ }
+ }
+
+ return cnt;
+}
+
+
+int cmGraphVizWriter::CollectAllExternalLibs(int cnt)
+{
+ // Ok, now find all the stuff we link to that is not in cmake
+ for (std::vector<cmLocalGenerator*>::const_iterator lit =
+ this->LocalGenerators.begin();
+ lit != this->LocalGenerators.end();
+ ++ lit )
+ {
+ const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
+ for ( cmTargets::const_iterator tit = targets->begin();
+ tit != targets->end();
+ ++ tit )
+ {
+ const char* realTargetName = tit->first.c_str();
+ if (this->IgnoreThisTarget(realTargetName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+ const cmTarget::LinkLibraryVectorType* ll =
+ &(tit->second.GetOriginalLinkLibraries());
+ for (cmTarget::LinkLibraryVectorType::const_iterator llit = ll->begin();
+ llit != ll->end();
+ ++ llit )
+ {
+ const char* libName = llit->first.c_str();
+ if (this->IgnoreThisTarget(libName))
+ {
+ // Skip ignored targets
+ continue;
+ }
+
+ std::map<cmStdString, const cmTarget*>::const_iterator tarIt =
+ this->TargetPtrs.find(libName);
+ if ( tarIt == this->TargetPtrs.end() )
+ {
+ cmOStringStream ostr;
+ ostr << this->GraphNodePrefix << cnt++;
+ this->TargetNamesNodes[libName] = ostr.str();
+ this->TargetPtrs[libName] = NULL;
+ //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
+ //<< "\" shape=\"ellipse\"];" << std::endl;
+ }
+ }
+ }
+ }
+ return cnt;
+}
+
+
+bool cmGraphVizWriter::IgnoreThisTarget(const char* name)
+{
+ if (this->TargetIgnoreRegex.is_valid())
+ {
+ if (this->TargetIgnoreRegex.find(name))
+ {
+ return true;
+ }
+ }
+ return (this->TargetsToIgnore.find(name) != this->TargetsToIgnore.end());
+}
+
+
+bool cmGraphVizWriter::GenerateForTargetType(cmTarget::TargetType targetType)
+ const
+{
+ switch (targetType)
+ {
+ case cmTarget::EXECUTABLE:
+ return this->GenerateForExecutables;
+ case cmTarget::STATIC_LIBRARY:
+ return this->GenerateForStaticLibs;
+ case cmTarget::SHARED_LIBRARY:
+ return this->GenerateForSharedLibs;
+ case cmTarget::MODULE_LIBRARY:
+ return this->GenerateForModuleLibs;
+ default:
+ break;
+ }
+ return false;
+}
diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h
new file mode 100644
index 0000000..105eb96
--- /dev/null
+++ b/Source/cmGraphVizWriter.h
@@ -0,0 +1,84 @@
+#ifndef CMGRAPHVIZWRITER_H
+#define CMGRAPHVIZWRITER_H
+/*============================================================================
+ 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 "cmStandardIncludes.h"
+#include "cmLocalGenerator.h"
+#include "cmGeneratedFileStream.h"
+#include "cmTarget.h"
+#include <cmsys/RegularExpression.hxx>
+
+
+/** This class implements writing files for graphviz (dot) for graphs
+ * representing the dependencies between the targets in the project. */
+class cmGraphVizWriter
+{
+public:
+
+ cmGraphVizWriter(const std::vector<cmLocalGenerator*>& localGenerators);
+
+ void ReadSettings(const char* settingsFileName,
+ const char* fallbackSettingsFileName);
+
+ void WritePerTargetFiles(const char* fileName);
+
+ void WriteGlobalFile(const char* fileName);
+
+protected:
+
+ void CollectTargetsAndLibs();
+
+ int CollectAllTargets();
+
+ int CollectAllExternalLibs(int cnt);
+
+ void WriteHeader(cmGeneratedFileStream& str) const;
+
+ void WriteConnections(const char* targetName,
+ std::set<std::string>& insertedNodes,
+ std::set<std::string>& insertedConnections,
+ cmGeneratedFileStream& str) const;
+
+ void WriteNode(const char* targetName, const cmTarget* target,
+ std::set<std::string>& insertedNodes,
+ cmGeneratedFileStream& str) const;
+
+ void WriteFooter(cmGeneratedFileStream& str) const;
+
+ bool IgnoreThisTarget(const char* name);
+
+ bool GenerateForTargetType(cmTarget::TargetType targetType) const;
+
+ cmStdString GraphType;
+ cmStdString GraphName;
+ cmStdString GraphHeader;
+ cmStdString GraphNodePrefix;
+
+ bool GenerateForExecutables;
+ bool GenerateForStaticLibs;
+ bool GenerateForSharedLibs;
+ bool GenerateForModuleLibs;
+
+ cmsys::RegularExpression TargetIgnoreRegex;
+
+ std::set<cmStdString> TargetsToIgnore;
+
+ const std::vector<cmLocalGenerator*>& LocalGenerators;
+
+ std::map<cmStdString, const cmTarget*> TargetPtrs;
+ // maps from the actual target names to node names in dot:
+ std::map<cmStdString, cmStdString> TargetNamesNodes;
+
+ bool HaveTargetsAndLibs;
+};
+
+#endif
diff --git a/Source/cmLoadCacheCommand.cxx b/Source/cmLoadCacheCommand.cxx
index d2a07dc..a239e55 100644
--- a/Source/cmLoadCacheCommand.cxx
+++ b/Source/cmLoadCacheCommand.cxx
@@ -174,7 +174,8 @@ void cmLoadCacheCommand::CheckLine(const char* line)
// Check one line of the cache file.
std::string var;
std::string value;
- if(this->ParseEntry(line, var, value))
+ cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
+ if(cmCacheManager::ParseEntry(line, var, value, type))
{
// Found a real entry. See if this one was requested.
if(this->VariablesToRead.find(var) != this->VariablesToRead.end())
@@ -193,38 +194,3 @@ void cmLoadCacheCommand::CheckLine(const char* line)
}
}
}
-
-//----------------------------------------------------------------------------
-bool cmLoadCacheCommand::ParseEntry(const char* entry, std::string& var,
- std::string& value)
-{
- // input line is: key:type=value
- cmsys::RegularExpression reg("^([^:]*):([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- // input line is: "key":type=value
- cmsys::RegularExpression
- regQuoted("^\"([^\"]*)\":([^=]*)=(.*[^\t ]|[\t ]*)[\t ]*$");
- bool flag = false;
- if(regQuoted.find(entry))
- {
- var = regQuoted.match(1);
- value = regQuoted.match(3);
- flag = true;
- }
- else if (reg.find(entry))
- {
- var = reg.match(1);
- value = reg.match(3);
- flag = true;
- }
-
- // if value is enclosed in single quotes ('foo') then remove them
- // it is used to enclose trailing space or tab
- if (flag &&
- value.size() >= 2 &&
- value[0] == '\'' &&
- value[value.size() - 1] == '\'')
- {
- value = value.substr(1, value.size() - 2);
- }
- return flag;
-}
diff --git a/Source/cmLoadCacheCommand.h b/Source/cmLoadCacheCommand.h
index b06d94d..8ecee4a 100644
--- a/Source/cmLoadCacheCommand.h
+++ b/Source/cmLoadCacheCommand.h
@@ -83,7 +83,6 @@ protected:
bool ReadWithPrefix(std::vector<std::string> const& args);
void CheckLine(const char* line);
- bool ParseEntry(const char* entry, std::string& var, std::string& value);
};
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 5bffd52..b7d694c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1818,8 +1818,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
//----------------------------------------------------------------------------
-std::string cmLocalGenerator::GetRealDependency(const char* inName,
- const char* config)
+bool cmLocalGenerator::GetRealDependency(const char* inName,
+ const char* config,
+ std::string& dep)
{
// Older CMake code may specify the dependency using the target
// output file rather than the target name. Such code would have
@@ -1855,7 +1856,8 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
// it is a full path to a depend that has the same name
// as a target but is in a different location so do not use
// the target as the depend
- return inName;
+ dep = inName;
+ return true;
}
}
switch (target->GetType())
@@ -1869,15 +1871,16 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
// Get the location of the target's output file and depend on it.
if(const char* location = target->GetLocation(config))
{
- return location;
+ dep = location;
+ return true;
}
}
break;
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
- // Depending on a utility target may not work but just trust
- // the user to have given a valid name.
- return inName;
+ // A utility target has no file on which to depend. This was listed
+ // only to get the target-level dependency.
+ return false;
case cmTarget::INSTALL_FILES:
case cmTarget::INSTALL_PROGRAMS:
case cmTarget::INSTALL_DIRECTORY:
@@ -1889,23 +1892,24 @@ std::string cmLocalGenerator::GetRealDependency(const char* inName,
if(cmSystemTools::FileIsFullPath(inName))
{
// This is a full path. Return it as given.
- return inName;
+ dep = inName;
+ return true;
}
// Check for a source file in this directory that matches the
// dependency.
if(cmSourceFile* sf = this->Makefile->GetSource(inName))
{
- name = sf->GetFullPath();
- return name;
+ dep = sf->GetFullPath();
+ return true;
}
// Treat the name as relative to the source directory in which it
// was given.
- name = this->Makefile->GetCurrentDirectory();
- name += "/";
- name += inName;
- return name;
+ dep = this->Makefile->GetCurrentDirectory();
+ dep += "/";
+ dep += inName;
+ return true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 43bf1e7..870ce36 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -158,14 +158,16 @@ public:
/** Translate a dependency as given in CMake code to the name to
appear in a generated build file. If the given name is that of
+ a utility target, returns false. If the given name is that of
a CMake target it will be transformed to the real output
location of that target for the given configuration. If the
given name is the full path to a file it will be returned.
Otherwise the name is treated as a relative path with respect to
the source directory of this generator. This should only be
used for dependencies of custom commands. */
- std::string GetRealDependency(const char* name, const char* config);
-
+ bool GetRealDependency(const char* name, const char* config,
+ std::string& dep);
+
/** Translate a command as given in CMake code to the location of the
executable if the command is the name of a CMake executable target.
If that's not the case, just return the original name. */
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f04d0a0..15ae139 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -140,7 +140,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
// write the local Makefile
this->WriteLocalMakefile();
-
+
// Write the cmake file with information for this directory.
this->WriteDirectoryInformationFile();
}
@@ -149,7 +149,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
void cmLocalUnixMakefileGenerator3::GetIndividualFileTargets
(std::vector<std::string>& targets)
{
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
+ for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
@@ -188,10 +188,10 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
{
ruleFileStream.SetCopyIfDifferent(true);
}
-
+
// write the all rules
this->WriteLocalAllRules(ruleFileStream);
-
+
// only write local targets unless at the top Keep track of targets already
// listed.
std::set<cmStdString> emittedTargets;
@@ -203,7 +203,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
}
else
{
- cmGlobalUnixMakefileGenerator3 *gg =
+ cmGlobalUnixMakefileGenerator3 *gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
gg->WriteConvenienceRules(ruleFileStream,emittedTargets);
}
@@ -215,7 +215,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// now write out the object rules
// for each object file name
- for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
+ for (std::map<cmStdString, LocalObjectInfo>::iterator lo =
this->LocalObjectFiles.begin();
lo != this->LocalObjectFiles.end(); ++lo)
{
@@ -261,7 +261,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefile()
// add a help target as long as there isn;t a real target named help
if(emittedTargets.insert("help").second)
{
- cmGlobalUnixMakefileGenerator3 *gg =
+ cmGlobalUnixMakefileGenerator3 *gg =
static_cast<cmGlobalUnixMakefileGenerator3*>(this->GlobalGenerator);
gg->WriteHelpRule(ruleFileStream,this);
}
@@ -353,7 +353,7 @@ void cmLocalUnixMakefileGenerator3
localName += "/rule";
commands.clear();
depends.clear();
-
+
// Build the target for this pass.
std::string makefile2 = cmake::GetCMakeFilesDirectoryPostSlash();
makefile2 += "Makefile2";
@@ -364,7 +364,7 @@ void cmLocalUnixMakefileGenerator3
cmLocalGenerator::START_OUTPUT);
this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
localName.c_str(), depends, commands, true);
-
+
// Add a target with the canonical name (no prefix, suffix or path).
if(localName != t->second.GetName())
{
@@ -378,7 +378,7 @@ void cmLocalUnixMakefileGenerator3
std::string makefileName = this->GetRelativeTargetDirectory(t->second);
makefileName += "/build.make";
// make sure the makefile name is suitable for a makefile
- std::string makeTargetName =
+ std::string makeTargetName =
this->GetRelativeTargetDirectory(t->second);
makeTargetName += "/build";
localName = t->second.GetName();
@@ -647,7 +647,7 @@ cmLocalUnixMakefileGenerator3
makefileStream
<< "# The CMake executable.\n"
<< "CMAKE_COMMAND = "
- << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
+ << this->Convert(cmakecommand.c_str(), FULL, SHELL).c_str()
<< "\n"
<< "\n";
makefileStream
@@ -656,7 +656,7 @@ cmLocalUnixMakefileGenerator3
<< this->Convert(cmakecommand.c_str(),FULL,SHELL).c_str()
<< " -E remove -f\n"
<< "\n";
-
+
if(const char* edit_cmd =
this->Makefile->GetDefinition("CMAKE_EDIT_COMMAND"))
{
@@ -722,8 +722,7 @@ cmLocalUnixMakefileGenerator3
// "VERBOSE=1" to be added as a make variable which will change the
// name of this special target. This gives a make-time choice to
// the user.
- if((this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
- || (gg->GetForceVerboseMakefiles()))
+ if(this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"))
{
makefileStream
<< "# Produce verbose output by default.\n"
@@ -872,7 +871,7 @@ cmLocalUnixMakefileGenerator3
{
// Add a dependency on the rule file itself unless an option to skip
// it is specifically enabled by the user or project.
- const char* nodep =
+ const char* nodep =
this->Makefile->GetDefinition("CMAKE_SKIP_RULE_DEPENDENCY");
if(!nodep || cmSystemTools::IsOff(nodep))
{
@@ -903,9 +902,12 @@ cmLocalUnixMakefileGenerator3
d != cc.GetDepends().end(); ++d)
{
// Lookup the real name of the dependency in case it is a CMake target.
- std::string dep = this->GetRealDependency
- (d->c_str(), this->ConfigurationName.c_str());
- depends.push_back(dep);
+ std::string dep;
+ if(this->GetRealDependency(d->c_str(), this->ConfigurationName.c_str(),
+ dep))
+ {
+ depends.push_back(dep);
+ }
}
}
@@ -969,7 +971,7 @@ cmLocalUnixMakefileGenerator3
{
// Build the command line in a single string.
const cmCustomCommandLine& commandLine = *cl;
- std::string cmd = GetRealLocation(commandLine[0].c_str(),
+ std::string cmd = GetRealLocation(commandLine[0].c_str(),
this->ConfigurationName.c_str());
if (cmd.size())
{
@@ -1283,7 +1285,7 @@ cmLocalUnixMakefileGenerator3
// see if the variable has been defined before and return
// the modified version of the variable
- std::map<cmStdString, cmStdString>::iterator i =
+ std::map<cmStdString, cmStdString>::iterator i =
this->MakeVariableMap.find(unmodified);
if(i != this->MakeVariableMap.end())
{
@@ -1404,7 +1406,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
dirInfoFile += "/CMakeDirectoryInformation.cmake";
{
int result;
- if(!ftc->FileTimeCompare(internalDependFile.c_str(),
+ if(!ftc->FileTimeCompare(internalDependFile.c_str(),
dirInfoFile.c_str(), &result) || result < 0)
{
if(verbose)
@@ -1418,7 +1420,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
needRescanDirInfo = true;
}
}
-
+
// Check the implicit dependencies to see if they are up to date.
// The build.make file may have explicit dependencies for the object
// files but these will not affect the scanning process so they need
@@ -1433,11 +1435,11 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
// cmDependsC::Check() fills the vector validDependencies() with the
// dependencies for those files where they are still valid, i.e. neither
// the files themselves nor any files they depend on have changed.
- // We don't do that if the CMakeDirectoryInformation.cmake file has
+ // We don't do that if the CMakeDirectoryInformation.cmake file has
// changed, because then potentially all dependencies have changed.
// This information is given later on to cmDependsC, which then only
// rescans the files where it did not get valid dependencies via this
- // dependency vector. This means that in the normal case, when only
+ // dependency vector. This means that in the normal case, when only
// few or one file have been edited, then also only this one file is
// actually scanned again, instead of all files for this target.
needRescanDependencies = !checker.Check(dependFile.c_str(),
@@ -1485,7 +1487,7 @@ cmLocalUnixMakefileGenerator3
{
haveDirectoryInfo = true;
}
-
+
// Lookup useful directory information.
if(haveDirectoryInfo)
{
@@ -1545,11 +1547,11 @@ cmLocalUnixMakefileGenerator3
this->WriteDisclaimer(ruleFileStream);
this->WriteDisclaimer(internalRuleFileStream);
- // for each language we need to scan, scan it
+ // for each language we need to scan, scan it
const char *langStr = mf->GetSafeDefinition("CMAKE_DEPENDS_LANGUAGES");
std::vector<std::string> langs;
cmSystemTools::ExpandListArgument(langStr, langs);
- for (std::vector<std::string>::iterator li =
+ for (std::vector<std::string>::iterator li =
langs.begin(); li != langs.end(); ++li)
{
// construct the checker
@@ -1572,7 +1574,7 @@ cmLocalUnixMakefileGenerator3
scanner = new cmDependsJava();
}
#endif
-
+
if (scanner)
{
scanner->SetLocalGenerator(this);
@@ -1686,25 +1688,25 @@ void cmLocalUnixMakefileGenerator3
cmLocalUnixMakefileGenerator3::EchoGlobal);
// Global targets store their rules in pre- and post-build commands.
- this->AppendCustomDepends(depends,
+ this->AppendCustomDepends(depends,
glIt->second.GetPreBuildCommands());
- this->AppendCustomDepends(depends,
+ this->AppendCustomDepends(depends,
glIt->second.GetPostBuildCommands());
- this->AppendCustomCommands(commands,
+ this->AppendCustomCommands(commands,
glIt->second.GetPreBuildCommands(),
&glIt->second,
cmLocalGenerator::START_OUTPUT);
- this->AppendCustomCommands(commands,
+ this->AppendCustomCommands(commands,
glIt->second.GetPostBuildCommands(),
&glIt->second,
cmLocalGenerator::START_OUTPUT);
std::string targetName = glIt->second.GetName();
- this->WriteMakeRule(ruleFileStream, targetString.c_str(),
+ this->WriteMakeRule(ruleFileStream, targetString.c_str(),
targetName.c_str(), depends, commands, true);
// Provide a "/fast" version of the target.
depends.clear();
- if((targetName == "install")
+ if((targetName == "install")
|| (targetName == "install_local")
|| (targetName == "install_strip"))
{
@@ -1738,7 +1740,7 @@ void cmLocalUnixMakefileGenerator3
progressDir += cmake::GetCMakeFilesDirectory();
{
cmOStringStream progCmd;
- progCmd <<
+ progCmd <<
"$(CMAKE_COMMAND) -E cmake_progress_start ";
progCmd << this->Convert(progressDir.c_str(),
cmLocalGenerator::FULL,
@@ -1833,8 +1835,8 @@ void cmLocalUnixMakefileGenerator3
this->CreateCDCommand(commands,
this->Makefile->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT);
- this->WriteMakeRule(ruleFileStream, "clear depends",
- "depend",
+ this->WriteMakeRule(ruleFileStream, "clear depends",
+ "depend",
depends, commands, true);
}
@@ -2048,7 +2050,7 @@ cmLocalUnixMakefileGenerator3
cmd += "$(MAKE) -f ";
cmd += this->Convert(makefile,NONE,SHELL);
cmd += " ";
-
+
// Pass down verbosity level.
if(this->GetMakeSilentFlag().size())
{
@@ -2125,7 +2127,7 @@ cmLocalUnixMakefileGenerator3
std::string
cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
{
-
+
// Split the path into its components.
std::vector<std::string> components;
cmSystemTools::SplitPath(p, components);
@@ -2224,7 +2226,7 @@ void cmLocalUnixMakefileGenerator3
{
return;
}
-
+
if(!this->UnixCD)
{
// On Windows we must perform each step separately and then change
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index eb4e4a4..b50c133 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -686,10 +686,12 @@ cmLocalVisualStudio6Generator
++d)
{
// Lookup the real name of the dependency in case it is a CMake target.
- std::string dep = this->GetRealDependency(d->c_str(),
- config.c_str());
- fout << "\\\n\t" <<
- this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
+ std::string dep;
+ if(this->GetRealDependency(d->c_str(), config.c_str(), dep))
+ {
+ fout << "\\\n\t" <<
+ this->ConvertToOptionallyRelativeOutputPath(dep.c_str());
+ }
}
fout << "\n";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index cb34bb6..9a87cc4 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -669,6 +669,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.FixExceptionHandlingDefault();
targetOptions.Parse(flags.c_str());
targetOptions.Parse(defineFlags.c_str());
+ targetOptions.ParseFinish();
targetOptions.AddDefines
(this->Makefile->GetProperty("COMPILE_DEFINITIONS"));
targetOptions.AddDefines(target.GetProperty("COMPILE_DEFINITIONS"));
@@ -1098,11 +1099,13 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") )
{
- fout << "\t\t\t\tSubSystem=\"2\"\n";
+ fout << "\t\t\t\tSubSystem=\""
+ << (this->FortranProject? "subSystemWindows" : "2") << "\"\n";
}
else
{
- fout << "\t\t\t\tSubSystem=\"1\"\n";
+ fout << "\t\t\t\tSubSystem=\""
+ << (this->FortranProject? "subSystemConsole" : "1") << "\"\n";
}
std::string stackVar = "CMAKE_";
stackVar += linkLanguage;
@@ -1621,9 +1624,12 @@ WriteCustomRule(std::ostream& fout,
++d)
{
// Get the real name of the dependency in case it is a CMake target.
- std::string dep = this->GetRealDependency(d->c_str(), i->c_str());
- fout << this->ConvertToXMLOutputPath(dep.c_str())
- << ";";
+ std::string dep;
+ if(this->GetRealDependency(d->c_str(), i->c_str(), dep))
+ {
+ fout << this->ConvertToXMLOutputPath(dep.c_str())
+ << ";";
+ }
}
}
fout << "\"\n";
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 56e0ed9..9983e5d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3590,6 +3590,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name)
return imported->second;
}
+ // Look for a target built in this directory.
+ if(cmTarget* t = this->FindTarget(name))
+ {
+ return t;
+ }
+
// Look for a target built in this project.
return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name);
}
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index ae62ac2..95f2868 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -849,7 +849,7 @@ cmMakefileTargetGenerator
p_depends.push_back(relativeObj);
this->LocalGenerator->WriteMakeRule(*this->BuildFileStream, 0,
temp.c_str(), p_depends, no_commands,
- true);
+ false);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx
index 19f5c0f..2b4414d 100644
--- a/Source/cmStringCommand.cxx
+++ b/Source/cmStringCommand.cxx
@@ -606,7 +606,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const&
return false;
}
int leftOverLength = intStringLength - begin;
- if ( end < 0 || end > leftOverLength )
+ if ( end < -1 || end > leftOverLength )
{
cmOStringStream ostr;
ostr << "end index: " << end << " is out of range " << 0 << " - "
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index ca61b1f..ef274b4 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1357,8 +1357,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
util = cmSystemTools::GetFilenameWithoutLastExtension(util);
}
- // Check for a non-imported target with this name.
- if(cmTarget* t = this->GlobalGenerator->FindTarget(0, util.c_str()))
+ // Check for a target with this name.
+ if(cmTarget* t = this->Makefile->FindTargetToUse(util.c_str()))
{
// If we find the target and the dep was given as a full path,
// then make sure it was not a full path to something else, and
@@ -1406,8 +1406,8 @@ cmTargetTraceDependencies
cit != cc.GetCommandLines().end(); ++cit)
{
std::string const& command = *cit->begin();
- // Look for a non-imported target with this name.
- if(cmTarget* t = this->GlobalGenerator->FindTarget(0, command.c_str()))
+ // Check for a target with this name.
+ if(cmTarget* t = this->Makefile->FindTargetToUse(command.c_str()))
{
if(t->GetType() == cmTarget::EXECUTABLE)
{
@@ -1450,6 +1450,15 @@ cmTargetTraceDependencies
//----------------------------------------------------------------------------
void cmTarget::TraceDependencies(const char* vsProjectFile)
{
+ // CMake-generated targets have no dependencies to trace. Normally tracing
+ // would find nothing anyway, but when building CMake itself the "install"
+ // target command ends up referencing the "cmake" target but we do not
+ // really want the dependency because "install" depend on "all" anyway.
+ if(this->GetType() == cmTarget::GLOBAL_TARGET)
+ {
+ return;
+ }
+
// Use a helper object to trace the dependencies.
cmTargetTraceDependencies tracer(this, this->Internal.Get(), vsProjectFile);
tracer.Trace();
@@ -3196,6 +3205,7 @@ void cmTarget::GetLibraryNames(std::string& name,
// the library version as the soversion.
soversion = version;
}
+ bool isApple = this->Makefile->IsOn("APPLE");
// Get the components of the library name.
std::string prefix;
@@ -3207,26 +3217,33 @@ void cmTarget::GetLibraryNames(std::string& name,
name = prefix+base+suffix;
// The library's soname.
-#if defined(__APPLE__)
- soName = prefix+base;
-#else
- soName = name;
-#endif
+ if(isApple)
+ {
+ soName = prefix+base;
+ }
+ else
+ {
+ soName = name;
+ }
if(soversion)
{
soName += ".";
soName += soversion;
}
-#if defined(__APPLE__)
- soName += suffix;
-#endif
+ if(isApple)
+ {
+ soName += suffix;
+ }
// The library's real name on disk.
-#if defined(__APPLE__)
- realName = prefix+base;
-#else
+ if(isApple)
+ {
+ realName = prefix+base;
+ }
+ else
+ {
realName = name;
-#endif
+ }
if(version)
{
realName += ".";
@@ -3237,9 +3254,10 @@ void cmTarget::GetLibraryNames(std::string& name,
realName += ".";
realName += soversion;
}
-#if defined(__APPLE__)
- realName += suffix;
-#endif
+ if(isApple)
+ {
+ realName += suffix;
+ }
// The import library name.
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h
new file mode 100644
index 0000000..258bacd
--- /dev/null
+++ b/Source/cmTargetDepend.h
@@ -0,0 +1,48 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2010 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmTargetDepend_h
+#define cmTargetDepend_h
+
+#include "cmStandardIncludes.h"
+
+class cmTarget;
+
+/** One edge in the global target dependency graph.
+ It may be marked as a 'link' or 'util' edge or both. */
+class cmTargetDepend
+{
+ cmTarget* Target;
+
+ // The set order depends only on the Target, so we use
+ // mutable members to acheive a map with set syntax.
+ mutable bool Link;
+ mutable bool Util;
+public:
+ cmTargetDepend(cmTarget* t): Target(t), Link(false), Util(false) {}
+ operator cmTarget*() const { return this->Target; }
+ cmTarget* operator->() const { return this->Target; }
+ cmTarget& operator*() const { return *this->Target; }
+ friend bool operator < (cmTargetDepend const& l, cmTargetDepend const& r)
+ { return l.Target < r.Target; }
+ void SetType(bool strong) const
+ {
+ if(strong) { this->Util = true; }
+ else { this->Link = true; }
+ }
+ bool IsLink() const { return this->Link; }
+ bool IsUtil() const { return this->Util; }
+};
+
+/** Unordered set of (direct) dependencies of a target. */
+class cmTargetDependSet: public std::set<cmTargetDepend> {};
+
+#endif
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 524be8b..f78aeec 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -244,6 +244,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
+ cmGlobalVisualStudio10Generator* gg =
+ static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
std::vector<std::string> *configs =
static_cast<cmGlobalVisualStudio7Generator *>
(this->GlobalGenerator)->GetConfigurations();
@@ -291,6 +293,13 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
}
+ if(const char* toolset = gg->GetPlatformToolset())
+ {
+ std::string pts = "<PlatformToolset>";
+ pts += toolset;
+ pts += "</PlatformToolset>\n";
+ this->WriteString(pts.c_str(), 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
}
@@ -386,10 +395,12 @@ cmVisualStudio10TargetGenerator::WriteCustomRule(cmSourceFile* source,
d != command.GetDepends().end();
++d)
{
- std::string dep = this->LocalGenerator->
- GetRealDependency(d->c_str(), i->c_str());
- this->ConvertToWindowsSlash(dep);
- (*this->BuildFileStream ) << ";" << dep;
+ std::string dep;
+ if(this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(), dep))
+ {
+ this->ConvertToWindowsSlash(dep);
+ (*this->BuildFileStream ) << ";" << dep;
+ }
}
(*this->BuildFileStream ) << ";%(AdditionalInputs)</AdditionalInputs>\n";
this->WritePlatformConfigTag("Outputs", i->c_str(), 3);
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx
index 972af95..f1bad9c 100644
--- a/Source/cmVisualStudioGeneratorOptions.cxx
+++ b/Source/cmVisualStudioGeneratorOptions.cxx
@@ -45,6 +45,10 @@ cmVisualStudioGeneratorOptions
// Slash options are allowed for VS.
this->AllowSlash = true;
+
+ this->FortranRuntimeDebug = false;
+ this->FortranRuntimeDLL = false;
+ this->FortranRuntimeMT = false;
}
//----------------------------------------------------------------------------
@@ -133,8 +137,55 @@ void cmVisualStudioGeneratorOptions::Parse(const char* flags)
}
//----------------------------------------------------------------------------
+void cmVisualStudioGeneratorOptions::ParseFinish()
+{
+ if(this->CurrentTool == FortranCompiler)
+ {
+ // "RuntimeLibrary" attribute values:
+ // "rtMultiThreaded", "0", /threads /libs:static
+ // "rtMultiThreadedDLL", "2", /threads /libs:dll
+ // "rtMultiThreadedDebug", "1", /threads /dbglibs /libs:static
+ // "rtMultiThreadedDebugDLL", "3", /threads /dbglibs /libs:dll
+ // These seem unimplemented by the IDE:
+ // "rtSingleThreaded", "4", /libs:static
+ // "rtSingleThreadedDLL", "10", /libs:dll
+ // "rtSingleThreadedDebug", "5", /dbglibs /libs:static
+ // "rtSingleThreadedDebugDLL", "11", /dbglibs /libs:dll
+ std::string rl = "rtMultiThreaded";
+ rl += this->FortranRuntimeDebug? "Debug" : "";
+ rl += this->FortranRuntimeDLL? "DLL" : "";
+ this->FlagMap["RuntimeLibrary"] = rl;
+ }
+}
+
+//----------------------------------------------------------------------------
void cmVisualStudioGeneratorOptions::StoreUnknownFlag(const char* flag)
{
+ // Look for Intel Fortran flags that do not map well in the flag table.
+ if(this->CurrentTool == FortranCompiler)
+ {
+ if(strcmp(flag, "/dbglibs") == 0)
+ {
+ this->FortranRuntimeDebug = true;
+ return;
+ }
+ if(strcmp(flag, "/threads") == 0)
+ {
+ this->FortranRuntimeMT = true;
+ return;
+ }
+ if(strcmp(flag, "/libs:dll") == 0)
+ {
+ this->FortranRuntimeDLL = true;
+ return;
+ }
+ if(strcmp(flag, "/libs:static") == 0)
+ {
+ this->FortranRuntimeDLL = false;
+ return;
+ }
+ }
+
// This option is not known. Store it in the output flags.
this->FlagString += " ";
this->FlagString +=
diff --git a/Source/cmVisualStudioGeneratorOptions.h b/Source/cmVisualStudioGeneratorOptions.h
index f7d1a02..8619ba0 100644
--- a/Source/cmVisualStudioGeneratorOptions.h
+++ b/Source/cmVisualStudioGeneratorOptions.h
@@ -39,6 +39,7 @@ public:
// Store options from command line flags.
void Parse(const char* flags);
+ void ParseFinish();
// Fix the ExceptionHandling option to default to off.
void FixExceptionHandlingDefault();
@@ -67,6 +68,10 @@ private:
Tool CurrentTool;
cmVisualStudio10TargetGenerator* TargetGenerator;
+ bool FortranRuntimeDebug;
+ bool FortranRuntimeDLL;
+ bool FortranRuntimeMT;
+
virtual void StoreUnknownFlag(const char* flag);
};
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2ebd165..1b49837 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -26,6 +26,7 @@
#include "cmDocumentationFormatterText.h"
#if defined(CMAKE_BUILD_WITH_CMAKE)
+# include "cmGraphVizWriter.h"
# include "cmDependsFortran.h" // For -E cmake_copy_f90_mod callback.
# include "cmVariableWatch.h"
# include <cmsys/Terminal.h>
@@ -169,7 +170,7 @@ cmake::cmake()
this->ProgressCallback = 0;
this->ProgressCallbackClientData = 0;
this->ScriptMode = false;
-
+
#ifdef CMAKE_BUILD_WITH_CMAKE
this->VariableWatch = new cmVariableWatch;
this->VariableWatch->AddWatch("CMAKE_WORDS_BIGENDIAN",
@@ -362,8 +363,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
std::string var, value;
cmCacheManager::CacheEntryType type = cmCacheManager::UNINITIALIZED;
- if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type) ||
- cmCacheManager::ParseEntry(entry.c_str(), var, value))
+ if(cmCacheManager::ParseEntry(entry.c_str(), var, value, type))
{
this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
"No help, variable specified on the command line.", type);
@@ -382,7 +382,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
this->DoSuppressDevWarnings = true;
}
else if(arg.find("-Wdev",0) == 0)
- {
+ {
this->SuppressDevWarnings = false;
this->DoSuppressDevWarnings = true;
}
@@ -406,7 +406,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str());
//go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete;
- cmCacheManager::CacheIterator it =
+ cmCacheManager::CacheIterator it =
this->CacheManager->GetCacheIterator();
for ( it.Begin(); !it.IsAtEnd(); it.Next() )
{
@@ -422,8 +422,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
}
// now remove them from the cache
- for(std::vector<std::string>::const_iterator currentEntry =
- entriesToDelete.begin();
+ for(std::vector<std::string>::const_iterator currentEntry =
+ entriesToDelete.begin();
currentEntry != entriesToDelete.end();
++currentEntry)
{
@@ -791,7 +791,7 @@ int cmake::AddCMakePaths()
cMakeSelf += "/cmake";
std::cerr << cMakeSelf.c_str() << "\n";
}
-#endif
+#endif
if(!cmSystemTools::FileExists(cMakeSelf.c_str()))
{
cmSystemTools::Error("CMake executable cannot be found at ",
@@ -802,12 +802,12 @@ int cmake::AddCMakePaths()
this->CacheManager->AddCacheEntry
("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.",
cmCacheManager::INTERNAL);
- // if the edit command is not yet in the cache,
+ // if the edit command is not yet in the cache,
// or if CMakeEditCommand has been set on this object,
// then set the CMAKE_EDIT_COMMAND in the cache
// This will mean that the last gui to edit the cache
// will be the one that make edit_cache uses.
- if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND")
+ if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND")
|| !this->CMakeEditCommand.empty())
{
// Find and save the command to edit the cache
@@ -815,8 +815,8 @@ int cmake::AddCMakePaths()
if(!this->CMakeEditCommand.empty())
{
editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf)
- + std::string("/")
- + this->CMakeEditCommand
+ + std::string("/")
+ + this->CMakeEditCommand
+ cmSystemTools::GetFilenameExtension(cMakeSelf);
}
if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
@@ -936,7 +936,7 @@ void CMakeCommandUsage(const char* program)
errorStream
<< "cmake bootstrap\n";
#endif
- // If you add new commands, change here,
+ // If you add new commands, change here,
// and in cmakemain.cxx in the options table
errorStream
<< "Usage: " << program << " -E [command] [arguments ...]\n"
@@ -1091,7 +1091,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 0;
}
#endif
-
+
else if (args[1] == "make_directory" && args.size() == 3)
{
if(!cmSystemTools::MakeDirectory(args[2].c_str()))
@@ -1342,7 +1342,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
}
return 0;
}
-
+
// Command to create a symbolic link. Fails on platforms not
// supporting them.
else if (args[1] == "create_symlink" && args.size() == 4)
@@ -1410,7 +1410,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
// Use the make system's VERBOSE environment variable to enable
// verbose output. This can be skipped by also setting CMAKE_NO_VERBOSE
// (which is set by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// Create a cmake object instance to process dependencies.
@@ -1635,14 +1635,14 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
return 1;
}
-void cmake::AddExtraGenerator(const char* name,
+void cmake::AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction)
{
cmExternalMakefileProjectGenerator* extraGenerator = newFunction();
const std::vector<std::string>& supportedGlobalGenerators =
extraGenerator->GetSupportedGlobalGenerators();
- for(std::vector<std::string>::const_iterator
+ for(std::vector<std::string>::const_iterator
it = supportedGlobalGenerators.begin();
it != supportedGlobalGenerators.end();
++it )
@@ -1670,11 +1670,11 @@ void cmake::AddDefaultExtraGenerators()
#endif
#ifdef CMAKE_USE_KDEVELOP
- this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
+ this->AddExtraGenerator(cmGlobalKdevelopGenerator::GetActualName(),
&cmGlobalKdevelopGenerator::New);
- // for kdevelop also add the generator with just the name of the
+ // for kdevelop also add the generator with just the name of the
// extra generator, since it was this way since cmake 2.2
- this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()]
+ this->ExtraGenerators[cmGlobalKdevelopGenerator::GetActualName()]
= &cmGlobalKdevelopGenerator::New;
#endif
@@ -1690,7 +1690,7 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
{
names.push_back(i->first);
}
- for(RegisteredExtraGeneratorsMap::const_iterator
+ for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin();
i != this->ExtraGenerators.end(); ++i)
{
@@ -1828,7 +1828,7 @@ int cmake::DoPreConfigureChecks()
// do a sanity check on some values
if(this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
{
- std::string cacheStart =
+ std::string cacheStart =
this->CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY");
cacheStart += "/CMakeLists.txt";
std::string currentStart = this->GetHomeDirectory();
@@ -1872,13 +1872,13 @@ int cmake::HandleDeleteCacheVariables(const char* var)
cmCacheManager::CacheIterator ci = this->CacheManager->NewIterator();
std::vector<SaveCacheEntry> saved;
cmOStringStream warning;
- warning
+ warning
<< "You have changed variables that require your cache to be deleted.\n"
<< "Configure will be re-run and you may have to reset some variables.\n"
<< "The following variables have changed:\n";
for(std::vector<std::string>::iterator i = argsSplit.begin();
i != argsSplit.end(); ++i)
- {
+ {
SaveCacheEntry save;
save.key = *i;
warning << *i << "= ";
@@ -1892,7 +1892,7 @@ int cmake::HandleDeleteCacheVariables(const char* var)
}
saved.push_back(save);
}
-
+
// remove the cache
this->CacheManager->DeleteCache(this->GetStartOutputDirectory());
// load the empty cache
@@ -1964,7 +1964,7 @@ int cmake::ActualConfigure()
if ( !res )
{
this->CacheManager->AddCacheEntry
- ("CMAKE_HOME_DIRECTORY",
+ ("CMAKE_HOME_DIRECTORY",
this->GetHomeDirectory(),
"Start directory with the top level CMakeLists.txt file for this "
"project",
@@ -1974,9 +1974,9 @@ int cmake::ActualConfigure()
// no generator specified on the command line
if(!this->GlobalGenerator)
{
- const char* genName =
+ const char* genName =
this->CacheManager->GetCacheValue("CMAKE_GENERATOR");
- const char* extraGenName =
+ const char* extraGenName =
this->CacheManager->GetCacheValue("CMAKE_EXTRA_GENERATOR");
if(genName)
{
@@ -1998,7 +1998,7 @@ int cmake::ActualConfigure()
this->SetGlobalGenerator(new cmGlobalBorlandMakefileGenerator);
#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(CMAKE_BOOT_MINGW)
std::string installedCompiler;
- // Try to find the newest VS installed on the computer and
+ // Try to find the newest VS installed on the computer and
// use that as a default if -G is not specified
std::string vsregBase =
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
@@ -2062,11 +2062,11 @@ int cmake::ActualConfigure()
}
if(!this->CacheManager->GetCacheValue("CMAKE_GENERATOR"))
{
- this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
+ this->CacheManager->AddCacheEntry("CMAKE_GENERATOR",
this->GlobalGenerator->GetName(),
"Name of generator.",
cmCacheManager::INTERNAL);
- this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
+ this->CacheManager->AddCacheEntry("CMAKE_EXTRA_GENERATOR",
this->GlobalGenerator->GetExtraGeneratorName(),
"Name of external makefile project generator.",
cmCacheManager::INTERNAL);
@@ -2205,7 +2205,7 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure)
// set the cmake command
this->CMakeCommand = args[0];
-
+
if ( !this->ScriptMode )
{
// load the cache
@@ -2330,7 +2330,7 @@ void cmake::AddCacheEntry(const char* key, const char* value,
const char* helpString,
int type)
{
- this->CacheManager->AddCacheEntry(key, value,
+ this->CacheManager->AddCacheEntry(key, value,
helpString,
cmCacheManager::CacheEntryType(type));
}
@@ -2445,8 +2445,8 @@ void cmake::UpdateProgress(const char *msg, float prog)
}
}
-void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
- bool withCurrentCommands,
+void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
+ bool withCurrentCommands,
bool withCompatCommands) const
{
for(RegisteredCommandsMap::const_iterator j = this->Commands.begin();
@@ -2457,7 +2457,7 @@ void cmake::GetCommandDocumentation(std::vector<cmDocumentationEntry>& v,
{
continue;
}
-
+
cmDocumentationEntry e((*j).second->GetName(),
(*j).second->GetTerseDocumentation(),
(*j).second->GetFullDocumentation());
@@ -2493,7 +2493,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
delete generator;
v.push_back(e);
}
- for(RegisteredExtraGeneratorsMap::const_iterator
+ for(RegisteredExtraGeneratorsMap::const_iterator
i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
{
cmDocumentationEntry e;
@@ -2508,7 +2508,7 @@ void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
void cmake::UpdateConversionPathTable()
{
// Update the path conversion table with any specified file:
- const char* tablepath =
+ const char* tablepath =
this->CacheManager->GetCacheValue("CMAKE_PATH_TRANSLATION_FILE");
if(tablepath)
@@ -2540,7 +2540,7 @@ int cmake::CheckBuildSystem()
// the make system's VERBOSE environment variable to enable verbose
// output. This can be skipped by setting CMAKE_NO_VERBOSE (which is set
// by the Eclipse and KDevelop generators).
- bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
+ bool verbose = ((cmSystemTools::GetEnv("VERBOSE") != 0)
&& (cmSystemTools::GetEnv("CMAKE_NO_VERBOSE") == 0));
// This method will check the integrity of the build system if the
@@ -2549,7 +2549,7 @@ int cmake::CheckBuildSystem()
// If no file is provided for the check, we have to rerun.
if(this->CheckBuildSystemArgument.size() == 0)
- {
+ {
if(verbose)
{
cmOStringStream msg;
@@ -2565,7 +2565,7 @@ int cmake::CheckBuildSystem()
if(verbose)
{
cmOStringStream msg;
- msg << "Re-run cmake missing file: "
+ msg << "Re-run cmake missing file: "
<< this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2585,7 +2585,7 @@ int cmake::CheckBuildSystem()
if(verbose)
{
cmOStringStream msg;
- msg << "Re-run cmake error reading : "
+ msg << "Re-run cmake error reading : "
<< this->CheckBuildSystemArgument.c_str() << "\n";
cmSystemTools::Stdout(msg.str().c_str());
}
@@ -2835,253 +2835,27 @@ const char* cmake::GetCPackCommand()
return this->CPackCommand.c_str();
}
+
void cmake::GenerateGraphViz(const char* fileName) const
{
- cmGeneratedFileStream str(fileName);
- if ( !str )
- {
- return;
- }
- cmake cm;
- cmGlobalGenerator ggi;
- ggi.SetCMakeInstance(&cm);
- std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
- cmMakefile *mf = lg->GetMakefile();
-
- std::string infile = this->GetHomeOutputDirectory();
- infile += "/CMakeGraphVizOptions.cmake";
- if ( !cmSystemTools::FileExists(infile.c_str()) )
- {
- infile = this->GetHomeDirectory();
- infile += "/CMakeGraphVizOptions.cmake";
- if ( !cmSystemTools::FileExists(infile.c_str()) )
- {
- infile = "";
- }
- }
-
- if ( !infile.empty() )
- {
- if ( !mf->ReadListFile(0, infile.c_str()) )
- {
- cmSystemTools::Error("Problem opening GraphViz options file: ",
- infile.c_str());
- return;
- }
- std::cout << "Read GraphViz options file: " << infile.c_str()
- << std::endl;
- }
-
-#define __set_if_not_set(var, value, cmakeDefinition) \
- const char* var = mf->GetDefinition(cmakeDefinition); \
- if ( !var ) \
- { \
- var = value; \
- }
- __set_if_not_set(graphType, "digraph", "GRAPHVIZ_GRAPH_TYPE");
- __set_if_not_set(graphName, "GG", "GRAPHVIZ_GRAPH_NAME");
- __set_if_not_set(graphHeader, "node [\n fontsize = \"12\"\n];",
- "GRAPHVIZ_GRAPH_HEADER");
- __set_if_not_set(graphNodePrefix, "node", "GRAPHVIZ_NODE_PREFIX");
- const char* ignoreTargets = mf->GetDefinition("GRAPHVIZ_IGNORE_TARGETS");
- std::set<cmStdString> ignoreTargetsSet;
- if ( ignoreTargets )
- {
- std::vector<std::string> ignoreTargetsVector;
- cmSystemTools::ExpandListArgument(ignoreTargets,ignoreTargetsVector);
- std::vector<std::string>::iterator itvIt;
- for ( itvIt = ignoreTargetsVector.begin();
- itvIt != ignoreTargetsVector.end();
- ++ itvIt )
- {
- ignoreTargetsSet.insert(itvIt->c_str());
- }
- }
-
- str << graphType << " " << graphName << " {" << std::endl;
- str << graphHeader << std::endl;
-
- const cmGlobalGenerator* gg = this->GetGlobalGenerator();
- const std::vector<cmLocalGenerator*>& localGenerators =
- gg->GetLocalGenerators();
- std::vector<cmLocalGenerator*>::const_iterator lit;
- // for target deps
- // 1 - cmake target
- // 2 - external target
- // 0 - no deps
- std::map<cmStdString, int> targetDeps;
- std::map<cmStdString, const cmTarget*> targetPtrs;
- std::map<cmStdString, cmStdString> targetNamesNodes;
- int cnt = 0;
- // First pass get the list of all cmake targets
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- const char* realTargetName = tit->first.c_str();
- if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- //std::cout << "Found target: " << tit->first.c_str() << std::endl;
- cmOStringStream ostr;
- ostr << graphNodePrefix << cnt++;
- targetNamesNodes[realTargetName] = ostr.str();
- targetPtrs[realTargetName] = &tit->second;
- }
- }
- // Ok, now find all the stuff we link to that is not in cmake
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- const cmTarget::LinkLibraryVectorType* ll
- = &(tit->second.GetOriginalLinkLibraries());
- cmTarget::LinkLibraryVectorType::const_iterator llit;
- const char* realTargetName = tit->first.c_str();
- if ( ignoreTargetsSet.find(realTargetName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- if ( ll->size() > 0 )
- {
- targetDeps[realTargetName] = 1;
- }
- for ( llit = ll->begin(); llit != ll->end(); ++ llit )
- {
- const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(libName);
- if ( ignoreTargetsSet.find(libName) != ignoreTargetsSet.end() )
- {
- // Skip ignored targets
- continue;
- }
- if ( tarIt == targetNamesNodes.end() )
- {
- cmOStringStream ostr;
- ostr << graphNodePrefix << cnt++;
- targetDeps[libName] = 2;
- targetNamesNodes[libName] = ostr.str();
- //str << " \"" << ostr.c_str() << "\" [ label=\"" << libName
- //<< "\" shape=\"ellipse\"];" << std::endl;
- }
- else
- {
- std::map<cmStdString, int>::const_iterator depIt
- = targetDeps.find(libName);
- if ( depIt == targetDeps.end() )
- {
- targetDeps[libName] = 1;
- }
- }
- }
- }
- }
+#ifdef CMAKE_BUILD_WITH_CMAKE
+ std::auto_ptr<cmGraphVizWriter> gvWriter(
+ new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
- // Write out nodes
- std::map<cmStdString, int>::const_iterator depIt;
- for ( depIt = targetDeps.begin(); depIt != targetDeps.end(); ++ depIt )
- {
- const char* newTargetName = depIt->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(newTargetName);
- if ( tarIt == targetNamesNodes.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << newTargetName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
+ std::string settingsFile = this->GetHomeOutputDirectory();
+ settingsFile += "/CMakeGraphVizOptions.cmake";
+ std::string fallbackSettingsFile = this->GetHomeDirectory();
+ fallbackSettingsFile += "/CMakeGraphVizOptions.cmake";
- str << " \"" << tarIt->second.c_str() << "\" [ label=\""
- << newTargetName << "\" shape=\"";
- if ( depIt->second == 1 )
- {
- std::map<cmStdString, const cmTarget*>::const_iterator tarTypeIt =
- targetPtrs.find(newTargetName);
- if ( tarTypeIt == targetPtrs.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << newTargetName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
- const cmTarget* tg = tarTypeIt->second;
- switch ( tg->GetType() )
- {
- case cmTarget::EXECUTABLE:
- str << "house";
- break;
- case cmTarget::STATIC_LIBRARY:
- str << "diamond";
- break;
- case cmTarget::SHARED_LIBRARY:
- str << "polygon";
- break;
- case cmTarget::MODULE_LIBRARY:
- str << "octagon";
- break;
- default:
- str << "box";
- }
- }
- else
- {
- str << "ellipse";
- }
- str << "\"];" << std::endl;
- }
+ gvWriter->ReadSettings(settingsFile.c_str(), fallbackSettingsFile.c_str());
- // Now generate the connectivity
- for ( lit = localGenerators.begin(); lit != localGenerators.end(); ++ lit )
- {
- const cmTargets* targets = &((*lit)->GetMakefile()->GetTargets());
- cmTargets::const_iterator tit;
- for ( tit = targets->begin(); tit != targets->end(); ++ tit )
- {
- std::map<cmStdString, int>::iterator dependIt
- = targetDeps.find(tit->first.c_str());
- if ( dependIt == targetDeps.end() )
- {
- continue;
- }
- std::map<cmStdString, cmStdString>::iterator cmakeTarIt
- = targetNamesNodes.find(tit->first.c_str());
- const cmTarget::LinkLibraryVectorType* ll
- = &(tit->second.GetOriginalLinkLibraries());
- cmTarget::LinkLibraryVectorType::const_iterator llit;
- for ( llit = ll->begin(); llit != ll->end(); ++ llit )
- {
- const char* libName = llit->first.c_str();
- std::map<cmStdString, cmStdString>::const_iterator tarIt
- = targetNamesNodes.find(libName);
- if ( tarIt == targetNamesNodes.end() )
- {
- // We should not be here.
- std::cout << __LINE__ << " Cannot find library: " << libName
- << " even though it was added in the previous pass" << std::endl;
- abort();
- }
- str << " \"" << cmakeTarIt->second.c_str() << "\" -> \""
- << tarIt->second.c_str() << "\"" << std::endl;
- }
- }
- }
+ gvWriter->WritePerTargetFiles(fileName);
+ gvWriter->WriteGlobalFile(fileName);
- // TODO: Use dotted or something for external libraries
- //str << " \"node0\":f4 -> \"node12\"[color=\"#0000ff\" style=dotted]"
- //<< std::endl;
- //
- str << "}" << std::endl;
+#endif
}
+
//----------------------------------------------------------------------------
int cmake::SymlinkLibrary(std::vector<std::string>& args)
{
@@ -3336,7 +3110,7 @@ int cmake::ExecuteLinkScript(std::vector<std::string>& args)
void cmake::DefineProperties(cmake *cm)
{
cm->DefineProperty
- ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL,
+ ("REPORT_UNDEFINED_PROPERTIES", cmProperty::GLOBAL,
"If set, report any undefined properties to this file.",
"If this property is set to a filename then when CMake runs "
"it will report any properties or variables that were accessed "
@@ -3344,7 +3118,7 @@ void cmake::DefineProperties(cmake *cm)
);
cm->DefineProperty
- ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL,
+ ("TARGET_SUPPORTS_SHARED_LIBS", cmProperty::GLOBAL,
"Does the target platform support shared libraries.",
"TARGET_SUPPORTS_SHARED_LIBS is a boolean specifying whether the target "
"platform supports shared libraries. Basically all current general "
@@ -3381,7 +3155,7 @@ void cmake::DefineProperties(cmake *cm)
"this list.This property is used by the macros in FeatureSummary.cmake.");
cm->DefineProperty
("DISABLED_FEATURES", cmProperty::GLOBAL,
- "List of features which are disabled during the CMake run.",
+ "List of features which are disabled during the CMake run.",
"List of features which are disabled during the CMake run. Be default "
"it contains the names of all packages which were not found. This is "
"determined using the <NAME>_FOUND variables. Packages which are "
@@ -3531,13 +3305,13 @@ void cmake::DefineProperty(const char *name, cmProperty::ScopeType scope,
bool chained, const char *docSection)
{
this->PropertyDefinitions[scope].DefineProperty(name,scope,ShortDescription,
- FullDescription,
+ FullDescription,
docSection,
chained);
}
cmPropertyDefinition *cmake
-::GetPropertyDefinition(const char *name,
+::GetPropertyDefinition(const char *name,
cmProperty::ScopeType scope)
{
if (this->IsPropertyDefined(name,scope))
@@ -3547,7 +3321,7 @@ cmPropertyDefinition *cmake
return 0;
}
-void cmake::RecordPropertyAccess(const char *name,
+void cmake::RecordPropertyAccess(const char *name,
cmProperty::ScopeType scope)
{
this->AccessedProperties.insert
@@ -3619,13 +3393,13 @@ void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{
if (!this->IsPropertyDefined(ap->first.c_str(),ap->second) &&
aliasedProperties.find(std::pair<cmStdString,cmProperty::ScopeType>
- (ap->first,ap->second)) ==
+ (ap->first,ap->second)) ==
aliasedProperties.end())
{
const char *scopeStr = "";
switch (ap->second)
{
- case cmProperty::TARGET:
+ case cmProperty::TARGET:
scopeStr = "TARGET";
break;
case cmProperty::SOURCE_FILE:
@@ -3727,7 +3501,7 @@ const char *cmake::GetProperty(const char* prop, cmProperty::ScopeType scope)
}
else if ( propname == "COMMANDS" )
{
- cmake::RegisteredCommandsMap::iterator cmds
+ cmake::RegisteredCommandsMap::iterator cmds
= this->GetCommands()->begin();
for (unsigned int cc=0 ; cmds != this->GetCommands()->end(); ++ cmds )
{
@@ -3835,14 +3609,14 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// we have to find the module directory, so we can copy the files
this->AddCMakePaths();
- std::string modulesPath =
+ std::string modulesPath =
this->CacheManager->GetCacheValue("CMAKE_ROOT");
modulesPath += "/Modules";
std::string inFile = modulesPath;
inFile += "/SystemInformation.cmake";
std::string outFile = destPath;
outFile += "/CMakeLists.txt";
-
+
// Copy file
if(!cmSystemTools::cmCopyFile(inFile.c_str(), outFile.c_str()))
{
@@ -3850,7 +3624,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
<< "\" to \"" << outFile.c_str() << "\".\n";
return 1;
}
-
+
// do we write to a file or to stdout?
if (resultFile.size() == 0)
{
@@ -3876,7 +3650,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
// change back to the original directory
cmSystemTools::ChangeDirectory(cwd.c_str());
-
+
// echo results to stdout if needed
if (writeToStdout)
{
@@ -3897,7 +3671,7 @@ int cmake::GetSystemInformation(std::vector<std::string>& args)
fclose(fin);
}
}
-
+
// clean up the directory
cmSystemTools::RemoveADirectory(destPath.c_str());
return 0;
@@ -4016,7 +3790,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
for(std::vector<std::string>::iterator i = args.begin();
i != args.end(); ++i)
{
- // check for nmake temporary files
+ // check for nmake temporary files
if((*i)[0] == '@' && i->find("@CMakeFiles") != 0 )
{
std::ifstream fin(i->substr(1).c_str());
@@ -4041,6 +3815,10 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
{
hasIncremental = true;
}
+ if(cmSystemTools::Strucmp(i->c_str(), "/INCREMENTAL") == 0)
+ {
+ hasIncremental = true;
+ }
if(cmSystemTools::Strucmp(i->c_str(), "/MANIFEST:NO") == 0)
{
hasManifest = false;
@@ -4069,7 +3847,7 @@ int cmake::VisualStudioLink(std::vector<std::string>& args, int type)
type, hasManifest, verbose);
}
-int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+int cmake::ParseVisualStudioLinkCommand(std::vector<std::string>& args,
std::vector<cmStdString>& command,
std::string& targetName)
{
@@ -4120,7 +3898,7 @@ bool cmake::RunCommand(const char* comment,
&retCode, 0, false);
// always print the output of the command, unless
// it is the dumb rc command banner, but if the command
- // returned an error code then print the output anyway as
+ // returned an error code then print the output anyway as
// the banner may be mixed with some other important information.
if(output.find("Resource Compiler Version") == output.npos
|| retCode !=0)
@@ -4141,12 +3919,12 @@ bool cmake::RunCommand(const char* comment,
return retCode == 0;
}
-int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
+int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
int type, bool verbose)
{
// This follows the steps listed here:
// http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx
-
+
// 1. Compiler compiles the application and generates the *.obj files.
// 2. An empty manifest file is generated if this is a clean build and if
// not the previous one is reused.
@@ -4158,10 +3936,10 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
// on.
// 5. The manifest tool (mt.exe) is then used to generate the final
// manifest.
-
+
// If the final manifest is changed, then 6 and 7 are run, if not
// they are skipped, and it is done.
-
+
// 6. The resource compiler is invoked one more time.
// 7. Finally, the Linker does another incremental link, but since the
// only thing that has changed is the *.res file that contains the
@@ -4220,7 +3998,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
outputOpt += resourceFile;
rcCommand.push_back(outputOpt);
rcCommand.push_back(resourceInputFile);
- // Run rc command to create resource
+ // Run rc command to create resource
if(!cmake::RunCommand("RC Pass 1", rcCommand, verbose))
{
return -1;
@@ -4230,7 +4008,7 @@ int cmake::VisualStudioLinkIncremental(std::vector<std::string>& args,
{
return -1;
}
- // create mt command
+ // create mt command
std::string outArg("/out:");
outArg+= manifestFile;
mtCommand.push_back("/nologo");
@@ -4281,7 +4059,7 @@ int cmake::VisualStudioLinkNonIncremental(std::vector<std::string>& args,
{
return -1;
}
- // Run the link command as given
+ // Run the link command as given
linkCommand.push_back("/MANIFEST");
if(!cmake::RunCommand("LINK", linkCommand, verbose))
{
@@ -4472,7 +4250,7 @@ int cmake::Build(const std::string& dir,
makeProgram = it.GetValue();
return gen->Build(0, dir.c_str(),
projName.c_str(), target.c_str(),
- &output,
+ &output,
makeProgram.c_str(),
config.c_str(), clean, false, 0, true,
0, nativeOptions);
diff --git a/Source/cmake.h b/Source/cmake.h
index 8312795..435d38b 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -21,14 +21,14 @@
// command line arguments.
// 3) Load the cache by calling LoadCache (duh)
// 4) if you are using command line arguments with -D or -C flags then
-// call SetCacheArgs (or if for some other reason you want to modify the
+// call SetCacheArgs (or if for some other reason you want to modify the
// cache, do it now.
// 5) Finally call Configure
// 6) Let the user change values and go back to step 5
// 7) call Generate
//
// If your GUI allows the user to change the start & home directories then
-// you must at a minimum redo steps 2 through 7.
+// you must at a minimum redo steps 2 through 7.
//
@@ -50,6 +50,8 @@ class cmExternalMakefileProjectGenerator;
class cmDocumentationSection;
class cmPolicies;
class cmListFileBacktrace;
+class cmTarget;
+class cmGeneratedFileStream;
class cmake
{
@@ -73,14 +75,14 @@ class cmake
static const char *GetCMakeFilesDirectory() {return "/CMakeFiles";};
static const char *GetCMakeFilesDirectoryPostSlash() {
return "CMakeFiles/";};
-
+
//@{
/**
* Set/Get the home directory (or output directory) in the project. The
* home directory is the top directory of the project. It is where
* cmake was run. Remember that CMake processes
* CMakeLists files by recursing up the tree starting at the StartDirectory
- * and going up until it reaches the HomeDirectory.
+ * and going up until it reaches the HomeDirectory.
*/
void SetHomeDirectory(const char* dir);
const char* GetHomeDirectory() const
@@ -100,9 +102,9 @@ class cmake
* is the directory of the CMakeLists.txt file that started the current
* round of processing. Remember that CMake processes CMakeLists files by
* recursing up the tree starting at the StartDirectory and going up until
- * it reaches the HomeDirectory.
+ * it reaches the HomeDirectory.
*/
- void SetStartDirectory(const char* dir)
+ void SetStartDirectory(const char* dir)
{
this->cmStartDirectory = dir;
cmSystemTools::ConvertToUnixSlashes(this->cmStartDirectory);
@@ -158,7 +160,7 @@ class cmake
///! Return the global generator assigned to this instance of cmake
cmGlobalGenerator* GetGlobalGenerator() { return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake, const
- const cmGlobalGenerator* GetGlobalGenerator() const
+ const cmGlobalGenerator* GetGlobalGenerator() const
{ return this->GlobalGenerator; }
///! Return the global generator assigned to this instance of cmake
@@ -169,25 +171,25 @@ class cmake
///! get the cmCachemManager used by this invocation of cmake
cmCacheManager *GetCacheManager() { return this->CacheManager; }
-
+
///! set the cmake command this instance of cmake should use
void SetCMakeCommand(const char* cmd) { this->CMakeCommand = cmd; }
-
+
/**
* Given a variable name, return its value (as a string).
*/
const char* GetCacheDefinition(const char*) const;
///! Add an entry into the cache
- void AddCacheEntry(const char* key, const char* value,
- const char* helpString,
+ void AddCacheEntry(const char* key, const char* value,
+ const char* helpString,
int type);
- /**
+ /**
* Execute commands during the build process. Supports options such
* as echo, remove file etc.
*/
static int ExecuteCMakeCommand(std::vector<std::string>&);
- /**
+ /**
* Get the system information and write it to the file specified
*/
int GetSystemInformation(std::vector<std::string>&);
@@ -210,16 +212,16 @@ class cmake
/** Check if a command exists. */
bool CommandExists(const char* name) const;
-
+
///! Parse command line arguments
void SetArgs(const std::vector<std::string>&);
///! Is this cmake running as a result of a TRY_COMPILE command
bool GetIsInTryCompile() { return this->InTryCompile; }
-
+
///! Is this cmake running as a result of a TRY_COMPILE command
void SetIsInTryCompile(bool i) { this->InTryCompile = i; }
-
+
///! Parse command line arguments that might set cache values
bool SetCacheArgs(const std::vector<std::string>&);
@@ -227,9 +229,9 @@ class cmake
(const char*msg, float progress, void *);
/**
* Set the function used by GUI's to receive progress updates
- * Function gets passed: message as a const char*, a progress
+ * Function gets passed: message as a const char*, a progress
* amount ranging from 0 to 1.0 and client data. The progress
- * number provided may be negative in cases where a message is
+ * number provided may be negative in cases where a message is
* to be displayed without any progress percentage.
*/
void SetProgressCallback(ProgressCallbackType f, void* clientData=0);
@@ -244,14 +246,14 @@ class cmake
cmVariableWatch* GetVariableWatch() { return this->VariableWatch; }
/** Get the documentation entries for the supported commands.
- * If withCurrentCommands is true, the documentation for the
+ * If withCurrentCommands is true, the documentation for the
* recommended set of commands is included.
* If withCompatCommands is true, the documentation for discouraged
* (compatibility) commands is included.
* You probably don't want to set both to false.
*/
- void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
- bool withCurrentCommands = true,
+ void GetCommandDocumentation(std::vector<cmDocumentationEntry>& entries,
+ bool withCurrentCommands = true,
bool withCompatCommands = true) const;
void GetPropertiesDocumentation(std::map<std::string,
cmDocumentationSection *>&);
@@ -278,7 +280,7 @@ class cmake
*/
void SetScriptMode(bool mode) { this->ScriptMode = mode; }
bool GetScriptMode() { return this->ScriptMode; }
-
+
///! Debug the try compile stuff by not delelting the files
bool GetDebugTryCompile(){return this->DebugTryCompile;}
void DebugTryCompileOn(){this->DebugTryCompile = true;}
@@ -310,7 +312,7 @@ class cmake
void DefineProperty(const char *name, cmProperty::ScopeType scope,
const char *ShortDescription,
const char *FullDescription,
- bool chain = false,
+ bool chain = false,
const char *variableGroup = 0);
// get property definition
@@ -338,7 +340,7 @@ class cmake
}
void SetSuppressDevWarnings(bool v)
{
- this->SuppressDevWarnings = v;
+ this->SuppressDevWarnings = v;
this->DoSuppressDevWarnings = true;
}
@@ -357,10 +359,10 @@ protected:
cmPropertyMap Properties;
std::set<std::pair<cmStdString,cmProperty::ScopeType> > AccessedProperties;
- std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
+ std::map<cmProperty::ScopeType, cmPropertyDefinitionMap>
PropertyDefinitions;
- typedef
+ typedef
cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
typedef std::map<cmStdString,
CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
@@ -374,15 +376,15 @@ protected:
void AddDefaultCommands();
void AddDefaultGenerators();
void AddDefaultExtraGenerators();
- void AddExtraGenerator(const char* name,
+ void AddExtraGenerator(const char* name,
CreateExtraGeneratorFunctionType newFunction);
- cmPolicies *Policies;
+ cmPolicies *Policies;
cmGlobalGenerator *GlobalGenerator;
cmCacheManager *CacheManager;
- std::string cmHomeDirectory;
+ std::string cmHomeDirectory;
std::string HomeOutputDirectory;
- std::string cmStartDirectory;
+ std::string cmStartDirectory;
std::string StartOutputDirectory;
bool SuppressDevWarnings;
bool DoSuppressDevWarnings;
@@ -393,7 +395,7 @@ protected:
///! Check if CMAKE_CACHEFILE_DIR is set. If it is not, delete the log file.
/// If it is set, truncate it to 50kb
void TruncateOutputLog(const char* fname);
-
+
/**
* Method called to check build system integrity at build time.
* Returns 1 if CMake should rerun and 0 otherwise.
@@ -416,24 +418,24 @@ protected:
static int ExecuteLinkScript(std::vector<std::string>& args);
static int VisualStudioLink(std::vector<std::string>& args, int type);
static int VisualStudioLinkIncremental(std::vector<std::string>& args,
- int type,
+ int type,
bool verbose);
static int VisualStudioLinkNonIncremental(std::vector<std::string>& args,
int type,
bool hasManifest,
bool verbose);
- static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
- std::vector<cmStdString>& command,
+ static int ParseVisualStudioLinkCommand(std::vector<std::string>& args,
+ std::vector<cmStdString>& command,
std::string& targetName);
static bool RunCommand(const char* comment,
std::vector<cmStdString>& command,
bool verbose,
int* retCodeOut = 0);
cmVariableWatch* VariableWatch;
-
+
///! Find the full path to one of the cmake programs like ctest, cpack, etc.
std::string FindCMakeProgram(const char* name) const;
-private:
+private:
cmake(const cmake&); // Not implemented.
void operator=(const cmake&); // Not implemented.
ProgressCallbackType ProgressCallback;
@@ -458,7 +460,7 @@ private:
cmFileTimeComparison* FileComparison;
std::string GraphVizFile;
std::vector<std::string> DebugConfigs;
-
+
void UpdateConversionPathTable();
};
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index bcc7a96..a35a01f 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -61,6 +61,8 @@
# If not given the install rules
# will not be in any component.
#
+# KWSYS_INSTALL_EXPORT_NAME = The EXPORT option value for install(TARGETS) calls.
+#
# Example:
#
# SET(KWSYS_INSTALL_BIN_DIR bin)
@@ -236,6 +238,9 @@ IF(COMMAND INSTALL)
# Setup library install rules.
SET(KWSYS_INSTALL_LIBRARY_RULE)
IF(KWSYS_INSTALL_LIB_DIR)
+ IF(KWSYS_INSTALL_EXPORT_NAME)
+ LIST(APPEND KWSYS_INSTALL_LIBRARY_RULE EXPORT ${KWSYS_INSTALL_EXPORT_NAME})
+ ENDIF()
# Install the shared library to the lib directory.
SET(KWSYS_INSTALL_LIBRARY_RULE ${KWSYS_INSTALL_LIBRARY_RULE}
LIBRARY DESTINATION ${KWSYS_INSTALL_LIB_DIR}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 8aa99eb..60d6869 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -378,9 +378,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
if(endpos != kwsys_stl::string::npos)
{
- kwsys_stl::string convertedPath;
- Realpath(pathEnv.substr(start, endpos-start).c_str(), convertedPath);
- path.push_back(convertedPath);
+ path.push_back(pathEnv.substr(start, endpos-start));
start = endpos+1;
}
else
@@ -1642,7 +1640,7 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
kwsys_stl::string ret = path;
// remove // except at the beginning might be a cygwin drive
- kwsys_stl::string::size_type pos=0;
+ kwsys_stl::string::size_type pos=1;
while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
{
ret.erase(pos, 1);
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 9771f55..71d177d 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -15,7 +15,7 @@
SET(KWSYS_DATE_STAMP_YEAR 2010)
# KWSys version date month component. Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 11)
+SET(KWSYS_DATE_STAMP_MONTH 12)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 11)
+SET(KWSYS_DATE_STAMP_DAY 16)
diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx
index ad35c34..c0e74af 100644
--- a/Source/kwsys/testSystemTools.cxx
+++ b/Source/kwsys/testSystemTools.cxx
@@ -297,7 +297,7 @@ bool CheckStringOperations()
if (kwsys::SystemTools::ConvertToUnixOutputPath
("//Local Mojo/Hex Power Pack/Iffy Voodoo") !=
- "/Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
+ "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
{
kwsys_ios::cerr
<< "Problem with ConvertToUnixOutputPath "
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 0ab2a67..3fb4652 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -77,6 +77,13 @@ set(linux64_pgf90_libs "pgf90;pgf90_rpm1;pgf902;pgf90rtl;pgftnrtl;nspgc;pgc;rt;p
set(linux64_pgf90_dirs "/opt/compiler/pgi/linux86-64/8.0-3/lib;/usr/lib64;/usr/lib64/gcc/x86_64-suse-linux/4.1.2")
list(APPEND platforms linux64_pgf90)
+# nagfor dummy.f -Wl,-v
+set(linux64_nagfor_text " /usr/libexec/gcc/x86_64-redhat-linux/4.4.5/collect2 --no-add-needed --eh-frame-hdr --build-id -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crt1.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crti.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtbegin.o -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64 -L/lib/../lib64 -L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../.. /usr/local/NAG/lib/f90_init.o /usr/local/NAG/lib/quickfit.o dummy.o -rpath /usr/local/NAG/lib /usr/local/NAG/lib/libf53.so /usr/local/NAG/lib/libf53.a -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-redhat-linux/4.4.5/crtend.o /usr/lib/gcc/x86_64-redhat-linux/4.4.5/../../../../lib64/crtn.o")
+set(linux64_nagfor_libs "/usr/local/NAG/lib/f90_init.o;/usr/local/NAG/lib/quickfit.o;/usr/local/NAG/lib/libf53.a;m;c")
+set(linux64_nagfor_dirs "/usr/lib/gcc/x86_64-redhat-linux/4.4.5;/usr/lib64;/lib64;/usr/lib")
+set(linux64_nagfor_obj_regex "^/usr/local/NAG/lib")
+list(APPEND platforms linux64_nagfor)
+
# gcc dummy.c -v # in strange path
set(linux64_test1_text "
/this/might/match/as/a/linker/ld/but/it/is/not because the ld is not the last path component
@@ -380,7 +387,7 @@ list(APPEND platforms msys_g77)
# Test parsing for all above examples.
foreach(p IN LISTS platforms)
- cmake_parse_implicit_link_info("${${p}_text}" libs dirs log)
+ cmake_parse_implicit_link_info("${${p}_text}" libs dirs log "${${p}_obj_regex}")
foreach(v libs dirs)
if(NOT "${${v}}" STREQUAL "${${p}_${v}}")
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt
index 76208d4..746c9a7 100644
--- a/Tests/CustomCommand/CMakeLists.txt
+++ b/Tests/CustomCommand/CMakeLists.txt
@@ -130,6 +130,7 @@ ADD_CUSTOM_COMMAND(
################################################################
ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/foo.pre
DEPENDS ${PROJECT_SOURCE_DIR}/foo.in
+ TDocument # Ensure doc1.h generates before this target
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${PROJECT_SOURCE_DIR}/foo.in
${PROJECT_BINARY_DIR}/foo.pre
@@ -181,10 +182,6 @@ ADD_CUSTOM_COMMAND(OUTPUT ${PROJECT_BINARY_DIR}/generated.c
TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader)
-# must add a dependency on TDocument otherwise it might never build and
-# the CustomCommand executable really needs doc1.h
-ADD_DEPENDENCIES(CustomCommand TDocument)
-
##############################################################################
# Test for using just the target name as executable in the COMMAND
# section. Has to be recognized and replaced by CMake with the output
diff --git a/Tests/ExportImport/Import/A/CMakeLists.txt b/Tests/ExportImport/Import/A/CMakeLists.txt
index 34b8717..e65e362 100644
--- a/Tests/ExportImport/Import/A/CMakeLists.txt
+++ b/Tests/ExportImport/Import/A/CMakeLists.txt
@@ -75,8 +75,64 @@ foreach(c DEBUG RELWITHDEBINFO)
set_property(TARGET imp_testExe1b PROPERTY COMPILE_DEFINITIONS_${c} EXE_DBG)
endforeach(c)
+#-----------------------------------------------------------------------------
+# Create a custom target to generate a header for the libraries below.
+# Drive the header generation through an indirect chain of imported
+# target dependencies.
+
+# testLib2tmp1.h
+add_custom_command(
+ OUTPUT testLib2tmp1.h
+ VERBATIM COMMAND
+ ${CMAKE_COMMAND} -E echo "extern int testLib2(void);" > testLib2tmp1.h
+ )
+
+# hdr_testLib2tmp1 needs testLib2tmp1.h
+add_custom_target(hdr_testLib2tmp1 DEPENDS testLib2tmp1.h)
+
+# exp_testExe2 needs hdr_testLib2tmp1
+add_dependencies(exp_testExe2 hdr_testLib2tmp1)
+
+# testLib2tmp.h needs exp_testExe2
+add_custom_command(
+ OUTPUT testLib2tmp.h
+ VERBATIM COMMAND exp_testExe2
+ COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp1.h testLib2tmp.h
+ )
+
+# hdr_testLib2tmp needs testLib2tmp.h
+add_custom_target(hdr_testLib2tmp DEPENDS testLib2tmp.h)
+
+add_library(dep_testLib2tmp UNKNOWN IMPORTED)
+set_property(TARGET dep_testLib2tmp PROPERTY
+ IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/testLib2tmp.h)
+
+# dep_testLib2tmp needs hdr_testLib2tmp
+add_dependencies(dep_testLib2tmp hdr_testLib2tmp)
+
+# testLib2.h needs dep_testLib2tmp
+add_custom_command(
+ OUTPUT testLib2.h
+ VERBATIM COMMAND ${CMAKE_COMMAND} -E copy testLib2tmp.h testLib2.h
+ DEPENDS dep_testLib2tmp
+ )
+
+# hdr_testLib2 needs testLib2.h
+add_custom_target(hdr_testLib2 DEPENDS testLib2.h)
+
+add_library(dep_testLib2 UNKNOWN IMPORTED)
+
+# dep_testLib2 needs hdr_testLib2
+add_dependencies(dep_testLib2 hdr_testLib2)
+
+# exp_testLib2 and bld_testLib2 both need dep_testLib2
+add_dependencies(bld_testLib2 dep_testLib2)
+add_dependencies(exp_testLib2 dep_testLib2)
+
+#-----------------------------------------------------------------------------
# Create a library to be linked by another directory in this project
# to test transitive linking to otherwise invisible imported targets.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_library(imp_lib1 STATIC imp_lib1.c)
target_link_libraries(imp_lib1 exp_testLib2)
add_library(imp_lib1b STATIC imp_lib1.c)
diff --git a/Tests/ExportImport/Import/A/imp_lib1.c b/Tests/ExportImport/Import/A/imp_lib1.c
index d8c66e6..5b3215e 100644
--- a/Tests/ExportImport/Import/A/imp_lib1.c
+++ b/Tests/ExportImport/Import/A/imp_lib1.c
@@ -1,4 +1,4 @@
-extern int testLib2(void);
+#include "testLib2.h"
int imp_lib1(void)
{
diff --git a/Tests/StringFileTest/CMakeLists.txt b/Tests/StringFileTest/CMakeLists.txt
index 2e052bf..7792a35 100644
--- a/Tests/StringFileTest/CMakeLists.txt
+++ b/Tests/StringFileTest/CMakeLists.txt
@@ -256,3 +256,27 @@ endif()
if(NOT "${var_b}" STREQUAL "x")
message(FATAL_ERROR "count incorrect \"b\": [${var_b}]")
endif()
+
+# Test SUBSTRING command
+SET(ST_INPUTSTRING "0123456789")
+STRING(SUBSTRING ${ST_INPUTSTRING} 3 0 ST_EMPTY)
+STRING(SUBSTRING ${ST_INPUTSTRING} 1 1 ST_ONE)
+STRING(SUBSTRING ${ST_INPUTSTRING} 0 10 ST_ALL)
+STRING(SUBSTRING ${ST_INPUTSTRING} 0 -1 ST_ALL_MINUS)
+STRING(SUBSTRING ${ST_INPUTSTRING} 9 -1 ST_NINE)
+
+IF(ST_EMPTY)
+ MESSAGE(SEND_ERROR "SUBSTRING with length 0 does not return an empty string")
+ENDIF(ST_EMPTY)
+IF(NOT ST_ONE STREQUAL "1")
+ MESSAGE(SEND_ERROR "SUBSTING command does not cut the correct selected character, was \"" ${ST_ONE} "\", should be \"1\"")
+ENDIF(NOT ST_ONE STREQUAL "1")
+IF(NOT ST_INPUTSTRING STREQUAL ST_ALL)
+ MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with length")
+ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL)
+IF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS)
+ MESSAGE(SEND_ERROR "SUBSTRING does not return the whole string when selected with -1")
+ENDIF(NOT ST_INPUTSTRING STREQUAL ST_ALL_MINUS)
+IF(NOT ST_NINE STREQUAL "9")
+ MESSAGE(SEND_ERROR "SUBSTRING does not return the tail when selected with -1")
+ENDIF(NOT ST_NINE STREQUAL "9")
diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt
index 931e636..1e68968 100644
--- a/Tests/VSExternalInclude/CMakeLists.txt
+++ b/Tests/VSExternalInclude/CMakeLists.txt
@@ -50,3 +50,11 @@ IF(MSVC10)
ADD_DEPENDENCIES(VSExternalInclude lib1)
ENDIF()
+# Interaction testing between the FOLDER target property and
+# INCLUDE_EXTERNAL_MSPROJECT targets:
+set_target_properties(VSExternalInclude PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib1 PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib2 PROPERTIES FOLDER folder1/folder2)
+add_custom_target(EmptyCustomTarget)
+set_target_properties(EmptyCustomTarget PROPERTIES FOLDER folder1/folder2)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)