summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeFindEclipseCDT4.cmake19
-rw-r--r--Modules/ExternalProject.cmake70
-rw-r--r--Modules/FindBISON.cmake2
-rw-r--r--Modules/FindCxxTest.cmake102
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx9
-rw-r--r--Source/kwsys/SystemTools.cxx23
-rw-r--r--Source/kwsys/SystemTools.hxx.in6
-rw-r--r--Source/kwsys/kwsysDateStamp.cmake2
-rw-r--r--Tests/ExternalProject/CMakeLists.txt2
9 files changed, 191 insertions, 44 deletions
diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake
index 9cb7bed..836e4c9 100644
--- a/Modules/CMakeFindEclipseCDT4.cmake
+++ b/Modules/CMakeFindEclipseCDT4.cmake
@@ -47,16 +47,21 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines
# now find the builtin macros:
STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}")
+# A few example lines which the regexp below has to match properly:
+# #define MAX(a,b) ((a) > (b) ? (a) : (b))
+# #define __fastcall __attribute__((__fastcall__))
+# #define FOO (23)
+# #define __UINTMAX_TYPE__ long long unsigned int
+# #define __UINTMAX_TYPE__ long long unsigned int
+# #define __i386__ 1
FOREACH(nextLine ${_defineLines})
- STRING(REGEX REPLACE "#define " "" _defineRemoved "${nextLine}")
-# not sure why this longer regexp was in the patch, the shorter one in the line below seems to work just fine:
-# STRING(REGEX MATCH "[A-Za-z_][A-Za-z0-9_]*|[A-Za-z_][A-Za-z0-9_]*\\([A-Za-z0-9_, ]*\\)" _name "${_defineRemoved}")
- STRING(REGEX MATCH "[A-Za-z_][A-Za-z0-9_]*" _name "${_defineRemoved}")
- LIST(APPEND ${_resultDefines} "${_name}")
+ STRING(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}")
+ SET(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
+ STRING(STRIP "${CMAKE_MATCH_3}" _value)
+ #MESSAGE(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-")
- STRING(REPLACE ${_name} "" _nameRemoved "${_defineRemoved}")
- STRING(STRIP "${_nameRemoved}" _value)
+ LIST(APPEND ${_resultDefines} "${_name}")
IF(_value)
LIST(APPEND ${_resultDefines} "${_value}")
ELSE()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index cb3dd4e..d76796f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -39,7 +39,7 @@
# #--Install step---------------
# [INSTALL_DIR dir] # Installation prefix
# [INSTALL_COMMAND cmd...] # Command to drive install after build
-# #--Test step---------------
+# #--Test step------------------
# [TEST_BEFORE_INSTALL 1] # Add test step executed before install step
# [TEST_AFTER_INSTALL 1] # Add test step executed after install step
# [TEST_COMMAND cmd...] # Command to drive test
@@ -50,6 +50,8 @@
# [LOG_BUILD 1] # Wrap build in script to log output
# [LOG_TEST 1] # Wrap test in script to log output
# [LOG_INSTALL 1] # Wrap install in script to log output
+# #--Custom targets-------------
+# [STEP_TARGETS st1 st2 ...] # Generate custom targets for these steps
# )
# The *_DIR options specify directories for the project, with default
# directories computed as follows.
@@ -109,6 +111,35 @@
# It stores property values in variables of the same name.
# Property names correspond to the keyword argument names of
# 'ExternalProject_Add'.
+#
+# The 'ExternalProject_Add_StepTargets' function generates custom targets for
+# the steps listed:
+# ExternalProject_Add_StepTargets(<name> [step1 [step2 [...]]])
+#
+# If STEP_TARGETS is set then ExternalProject_Add_StepTargets is automatically
+# called at the end of matching calls to ExternalProject_Add_Step. Pass
+# STEP_TARGETS explicitly to individual ExternalProject_Add calls, or
+# implicitly to all ExternalProject_Add calls by setting the directory property
+# EP_STEP_TARGETS.
+#
+# If STEP_TARGETS is not set, clients may still manually call
+# ExternalProject_Add_StepTargets after calling ExternalProject_Add or
+# ExternalProject_Add_Step.
+#
+# This functionality is provided to make it easy to drive the steps
+# independently of each other by specifying targets on build command lines.
+# For example, you may be submitting to a sub-project based dashboard, where
+# you want to drive the configure portion of the build, then submit to the
+# dashboard, followed by the build portion, followed by tests. If you invoke
+# a custom target that depends on a step halfway through the step dependency
+# chain, then all the previous steps will also run to ensure everything is
+# up to date.
+#
+# For example, to drive configure, build and test steps independently for each
+# ExternalProject_Add call in your project, write the following line prior to
+# any ExternalProject_Add calls in your CMakeLists file:
+#
+# set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
@@ -124,7 +155,9 @@
# License text for the above reference.)
# Pre-compute a regex to match documented keywords for each command.
-file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines LIMIT_COUNT 103
+math(EXPR _ep_documentation_line_count "${CMAKE_CURRENT_LIST_LINE} - 16")
+file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines
+ LIMIT_COUNT ${_ep_documentation_line_count}
REGEX "^# ( \\[[A-Z0-9_]+ [^]]*\\] +#.*$|[A-Za-z0-9_]+\\()")
foreach(line IN LISTS lines)
if("${line}" MATCHES "^# [A-Za-z0-9_]+\\(")
@@ -208,6 +241,14 @@ define_property(DIRECTORY PROPERTY "EP_PREFIX" INHERITED
"ExternalProject module."
)
+define_property(DIRECTORY PROPERTY "EP_STEP_TARGETS" INHERITED
+ BRIEF_DOCS
+ "List of ExternalProject steps that automatically get corresponding targets"
+ FULL_DOCS
+ "See documentation of the ExternalProject_Add_StepTargets() function in the "
+ "ExternalProject module."
+ )
+
function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE git_repository git_tag src_name work_dir)
file(WRITE ${script_filename}
@@ -721,6 +762,19 @@ function(_ep_get_configuration_subdir_suffix suffix_var)
endfunction(_ep_get_configuration_subdir_suffix)
+function(ExternalProject_Add_StepTargets name)
+ set(steps ${ARGN})
+
+ _ep_get_configuration_subdir_suffix(cfgdir)
+ ExternalProject_Get_Property(${name} stamp_dir)
+
+ foreach(step ${steps})
+ add_custom_target(${name}-${step}
+ DEPENDS ${stamp_dir}${cfgdir}/${name}-${step})
+ endforeach()
+endfunction(ExternalProject_Add_StepTargets)
+
+
function(ExternalProject_Add_Step name step)
set(cmf_dir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles)
ExternalProject_Get_Property(${name} stamp_dir)
@@ -807,6 +861,18 @@ function(ExternalProject_Add_Step name step)
WORKING_DIRECTORY ${work_dir}
VERBATIM
)
+
+ # Add custom "step target"?
+ get_property(step_targets TARGET ${name} PROPERTY _EP_STEP_TARGETS)
+ if(NOT step_targets)
+ get_property(step_targets DIRECTORY PROPERTY EP_STEP_TARGETS)
+ endif()
+ foreach(st ${step_targets})
+ if("${st}" STREQUAL "${step}")
+ ExternalProject_Add_StepTargets(${name} ${step})
+ break()
+ endif()
+ endforeach()
endfunction(ExternalProject_Add_Step)
diff --git a/Modules/FindBISON.cmake b/Modules/FindBISON.cmake
index 0c622fb..6021b12 100644
--- a/Modules/FindBISON.cmake
+++ b/Modules/FindBISON.cmake
@@ -96,7 +96,7 @@ IF(BISON_EXECUTABLE)
#
MACRO(BISON_TARGET Name BisonInput BisonOutput)
SET(BISON_TARGET_output_header "")
- SET(BISON_TARGET_command_opt "")
+ SET(BISON_TARGET_cmdopt "")
SET(BISON_TARGET_outputs "${BisonOutput}")
IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
MESSAGE(SEND_ERROR "Usage")
diff --git a/Modules/FindCxxTest.cmake b/Modules/FindCxxTest.cmake
index 759b4fd..6a66d21 100644
--- a/Modules/FindCxxTest.cmake
+++ b/Modules/FindCxxTest.cmake
@@ -5,20 +5,37 @@
#
# INPUT Variables
#
-# CXXTEST_USE_PYTHON
-# If true, the CXXTEST_ADD_TEST macro will use
-# the Python test generator instead of Perl.
+# CXXTEST_USE_PYTHON [deprecated since 1.3]
+# Only used in the case both Python & Perl
+# are detected on the system to control
+# which CxxTest code generator is used.
+#
+# NOTE: In older versions of this Find Module,
+# this variable controlled if the Python test
+# generator was used instead of the Perl one,
+# regardless of which scripting language the
+# user had installed.
+#
+# CXXTEST_TESTGEN_ARGS (since CMake 2.8.3)
+# Specify a list of options to pass to the CxxTest code
+# generator. If not defined, --error-printer is
+# passed.
#
# OUTPUT Variables
#
# CXXTEST_FOUND
# True if the CxxTest framework was found
-# CXXTEST_INCLUDE_DIR
+# CXXTEST_INCLUDE_DIRS
# Where to find the CxxTest include directory
# CXXTEST_PERL_TESTGEN_EXECUTABLE
-# The perl-based test generator.
+# The perl-based test generator
# CXXTEST_PYTHON_TESTGEN_EXECUTABLE
-# The python-based test generator.
+# The python-based test generator
+# CXXTEST_TESTGEN_EXECUTABLE (since CMake 2.8.3)
+# The test generator that is actually used (chosen using user preferences
+# and interpreters found in the system)
+# CXXTEST_TESTGEN_INTERPRETER (since CMake 2.8.3)
+# The full path to the Perl or Python executable on the system
#
# MACROS for optional use by CMake users:
#
@@ -26,9 +43,11 @@
# Creates a CxxTest runner and adds it to the CTest testing suite
# Parameters:
# test_name The name of the test
-# gen_source_file The generated source filename to be generated by CxxTest
+# gen_source_file The generated source filename to be
+# generated by CxxTest
# input_files_to_testgen The list of header files containing the
-# CxxTest::TestSuite's to be included in this runner
+# CxxTest::TestSuite's to be included in
+# this runner
#
# #==============
# Example Usage:
@@ -65,8 +84,8 @@
#
#=============================================================================
-# Copyright 2008-2009 Kitware, Inc.
-# Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
+# Copyright 2008-2010 Kitware, Inc.
+# Copyright 2008-2010 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
@@ -78,6 +97,14 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+# 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
+# is now used to run the test generator program. If both interpreters
+# are detected, the CXXTEST_USE_PYTHON variable is obeyed.
+#
+# Also added support for CXXTEST_TESTGEN_ARGS, for manually specifying
+# options to the CxxTest code generator.
# Version 1.2 (3/2/08)
# Included patch from Tyler Roscoe to have the perl & python binaries
# detected based on CXXTEST_INCLUDE_DIR
@@ -95,17 +122,12 @@
#=============================================================
macro(CXXTEST_ADD_TEST _cxxtest_testname _cxxtest_outfname)
set(_cxxtest_real_outfname ${CMAKE_CURRENT_BINARY_DIR}/${_cxxtest_outfname})
- if(CXXTEST_USE_PYTHON)
- set(_cxxtest_executable ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
- else()
- set(_cxxtest_executable ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
- endif()
add_custom_command(
OUTPUT ${_cxxtest_real_outfname}
DEPENDS ${ARGN}
- COMMAND ${_cxxtest_executable}
- --error-printer -o ${_cxxtest_real_outfname} ${ARGN}
+ COMMAND ${CXXTEST_TESTGEN_INTERPRETER}
+ ${CXXTEST_TESTGEN_EXECUTABLE} ${CXXTEST_TESTGEN_ARGS} -o ${_cxxtest_real_outfname} ${ARGN}
)
set_source_files_properties(${_cxxtest_real_outfname} PROPERTIES GENERATED true)
@@ -124,14 +146,48 @@ endmacro(CXXTEST_ADD_TEST)
#=============================================================
# main()
#=============================================================
+if(NOT DEFINED CXXTEST_TESTGEN_ARGS)
+ set(CXXTEST_TESTGEN_ARGS --error-printer)
+endif()
+
+find_package(PythonInterp QUIET)
+find_package(Perl QUIET)
find_path(CXXTEST_INCLUDE_DIR cxxtest/TestSuite.h)
-find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
- PATHS ${CXXTEST_INCLUDE_DIR})
find_program(CXXTEST_PYTHON_TESTGEN_EXECUTABLE cxxtestgen.py
- PATHS ${CXXTEST_INCLUDE_DIR})
+ PATHS ${CXXTEST_INCLUDE_DIR})
+find_program(CXXTEST_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
+ PATHS ${CXXTEST_INCLUDE_DIR})
+
+if(PYTHONINTERP_FOUND OR PERL_FOUND)
+ include(FindPackageHandleStandardArgs)
+
+ if(PYTHONINTERP_FOUND AND (CXXTEST_USE_PYTHON OR NOT PERL_FOUND))
+ set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE})
+ set(CXXTEST_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ CXXTEST_INCLUDE_DIR CXXTEST_PYTHON_TESTGEN_EXECUTABLE)
+
+ elseif(PERL_FOUND)
+ set(CXXTEST_TESTGEN_EXECUTABLE ${CXXTEST_PERL_TESTGEN_EXECUTABLE})
+ set(CXXTEST_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG
+ CXXTEST_INCLUDE_DIR CXXTEST_PERL_TESTGEN_EXECUTABLE)
+ endif()
+
+ if(CXXTEST_FOUND)
+ set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
+ endif()
+
+else()
-include(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(CxxTest DEFAULT_MSG CXXTEST_INCLUDE_DIR)
+ set(CXXTEST_FOUND false)
+ if(NOT CxxTest_FIND_QUIETLY)
+ if(CxxTest_FIND_REQUIRED)
+ message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest, aborting!")
+ else()
+ message(STATUS "Neither Python nor Perl found, CxxTest will not be used.")
+ endif()
+ endif()
-set(CXXTEST_INCLUDE_DIRS ${CXXTEST_INCLUDE_DIR})
+endif()
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 59e20d5..ca522bb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1033,6 +1033,15 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
+
+ // If not in debug mode, write the DebugInformationFormat field
+ // without value so PDBs don't get generated uselessly.
+ if(!clOptions.IsDebug())
+ {
+ this->WriteString("<DebugInformationFormat>"
+ "</DebugInformationFormat>\n", 3);
+ }
+
clOptions.OutputPreprocessorDefinitions(*this->BuildFileStream, " ",
"\n");
this->WriteString("<AssemblerListingLocation>", 3);
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index bcdb193..8aa99eb 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -1405,6 +1405,10 @@ kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const char* p, char se
{
kwsys_stl::string path = p;
kwsys_stl::vector<kwsys::String> paths;
+ if(path.empty())
+ {
+ return paths;
+ }
if(isPath && path[0] == '/')
{
path.erase(path.begin());
@@ -3059,30 +3063,35 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
static int GetCasePathName(const kwsys_stl::string & pathIn,
kwsys_stl::string & casePath)
{
- kwsys_stl::vector<kwsys::String> path_components =
- SystemTools::SplitString(pathIn.c_str(), '/', true);
- if(path_components.empty())
+ kwsys_stl::vector<kwsys_stl::string> path_components;
+ SystemTools::SplitPath(pathIn.c_str(), path_components);
+ if(path_components[0].empty()) // First component always exists.
{
+ // Relative paths cannot be converted.
casePath = "";
return 0;
}
+
+ // Start with root component.
kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
- // assume always absolute path, so just take first
casePath = path_components[idx++];
+ const char* sep = "";
+
// If network path, fill casePath with server/share so FindFirstFile
// will work after that. Maybe someday call other APIs to get
// actual case of servers and shares.
- if(path_components.size() > 2 && pathIn.size() >= 2 &&
- pathIn[0] == '/' && pathIn[1] == '/')
+ if(path_components.size() > 2 && path_components[0] == "//")
{
casePath += path_components[idx++];
casePath += "/";
casePath += path_components[idx++];
+ sep = "/";
}
for(; idx < path_components.size(); idx++)
{
- casePath += "/";
+ casePath += sep;
+ sep = "/";
kwsys_stl::string test_str = casePath;
test_str += path_components[idx];
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index ec70320..cf47923 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -372,8 +372,8 @@ public:
* "c:/" = Windows full path (can be any drive letter)
* "c:" = Windows drive-letter relative path (can be any drive letter)
* "//" = Network path
- * "~" = Home path for current user
- * "~u" = Home path for user 'u'
+ * "~/" = Home path for current user
+ * "~u/" = Home path for user 'u'
* "" = Relative path
*
* A pointer to the rest of the path after the root component is
@@ -385,7 +385,7 @@ public:
/**
* Split a path name into its basic components. The first component
- * is one of the roots returned by SplitPathRootComponent.
+ * always exists and is the root returned by SplitPathRootComponent.
* The remaining components form the path. If there is a trailing
* slash then the last component is the empty string. The
* components can be recombined as "c[0]c[1]/c[2]/.../c[n]" to
diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake
index 6acbd29..8002939 100644
--- a/Source/kwsys/kwsysDateStamp.cmake
+++ b/Source/kwsys/kwsysDateStamp.cmake
@@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010)
SET(KWSYS_DATE_STAMP_MONTH 08)
# KWSys version date day component. Format is DD.
-SET(KWSYS_DATE_STAMP_DAY 24)
+SET(KWSYS_DATE_STAMP_DAY 31)
diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt
index 26c6deb..587cf57 100644
--- a/Tests/ExternalProject/CMakeLists.txt
+++ b/Tests/ExternalProject/CMakeLists.txt
@@ -10,6 +10,7 @@ find_package(Git)
set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
set(binary_base "${base}/Build")
set_property(DIRECTORY PROPERTY EP_BASE ${base})
+set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
if(NOT DEFINED can_build_tutorial_step5)
set(can_build_tutorial_step5 1)
@@ -61,6 +62,7 @@ ExternalProject_Add(${proj}
DOWNLOAD_COMMAND ""
INSTALL_COMMAND ""
PATCH_COMMAND ""
+ STEP_TARGETS install update
SVN_REPOSITORY ""
SVN_REVISION ""
TEST_COMMAND ""