diff options
30 files changed, 517 insertions, 150 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 40084b4..0143d59 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -545,13 +545,25 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # 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}") + string(LENGTH "${resolved_embedded_item}" resolved_embedded_item_length) + set(path_too_short 0) + set(is_embedded 0) + if(${resolved_embedded_item_length} LESS ${exe_dotapp_dir_length}) + set(path_too_short 1) + endif() + if(NOT path_too_short) + string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring) + if("${exe_dotapp_dir}/" STREQUAL "${item_substring}") + set(is_embedded 1) + endif() + endif() + if(NOT is_embedded) 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("Install or copy the item into the bundle before calling fixup_bundle.") + message("Or maybe there's a typo or incorrect path in one of the args to fixup_bundle?") message("") message(FATAL_ERROR "cannot fixup an item that is not in the bundle...") endif() diff --git a/Modules/Compiler/XL-Fortran.cmake b/Modules/Compiler/XL-Fortran.cmake index e6f2317..d88b3f3 100644 --- a/Modules/Compiler/XL-Fortran.cmake +++ b/Modules/Compiler/XL-Fortran.cmake @@ -1,6 +1,8 @@ include(Compiler/XL) __compiler_xl(Fortran) +SET(CMAKE_Fortran_MODDIR_FLAG "-qmoddir=") + SET(CMAKE_Fortran_DEFINE_FLAG "-WF,-D") # -qthreaded = Ensures that all optimizations will be thread-safe diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake index 90849a1..6f01ea0 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -9,10 +9,9 @@ # The module will optionally accept the COMPONENTS argument. If no COMPONENTS # are specified, then the find module will default to finding only the HDF5 C # library. If one or more COMPONENTS are specified, the module will attempt to -# find the language bindings for the specified components. Currently, the only -# valid components are C and CXX. The module does not yet support finding the -# Fortran bindings. If the COMPONENTS argument is not given, the module will -# attempt to find only the C bindings. +# find the language bindings for the specified components. The only valid +# components are C, CXX, Fortran, and HL. If the COMPONENTS argument is not +# given, the module will attempt to find only the C bindings. # # On UNIX systems, this module will read the variable HDF5_USE_STATIC_LIBRARIES # to determine whether or not to prefer a static link to a dynamic link for HDF5 @@ -33,12 +32,15 @@ # HDF5_DEFINITIONS - Required compiler definitions for HDF5 # HDF5_C_LIBRARIES - Required libraries for the HDF5 C bindings. # HDF5_CXX_LIBRARIES - Required libraries for the HDF5 C++ bindings +# HDF5_Fortran_LIBRARIES - Required libraries for the HDF5 Fortran bindings +# HDF5_HL_LIBRARIES - Required libraries for the HDF5 high level API # HDF5_LIBRARIES - Required libraries for all requested bindings # HDF5_FOUND - true if HDF5 was found on the system # HDF5_LIBRARY_DIRS - the full set of library directories # HDF5_IS_PARALLEL - Whether or not HDF5 was found with parallel IO support # HDF5_C_COMPILER_EXECUTABLE - the path to the HDF5 C wrapper compiler # HDF5_CXX_COMPILER_EXECUTABLE - the path to the HDF5 C++ wrapper compiler +# HDF5_Fortran_COMPILER_EXECUTABLE - the path to the HDF5 Fortran wrapper compiler # HDF5_DIFF_EXECUTABLE - the path to the HDF5 dataset comparison tool #============================================================================= @@ -63,8 +65,26 @@ include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) set( HDF5_VALID_COMPONENTS C CXX + Fortran + HL ) +# Validate the list of find components. +if( NOT HDF5_FIND_COMPONENTS ) + set( HDF5_LANGUAGE_BINDINGS "C" ) +else() + # add the extra specified components, ensuring that they are valid. + foreach( component ${HDF5_FIND_COMPONENTS} ) + list( FIND HDF5_VALID_COMPONENTS ${component} component_location ) + if( ${component_location} EQUAL -1 ) + message( FATAL_ERROR + "\"${component}\" is not a valid HDF5 component." ) + else() + list( APPEND HDF5_LANGUAGE_BINDINGS ${component} ) + endif() + endforeach() +endif() + # try to find the HDF5 wrapper compilers find_program( HDF5_C_COMPILER_EXECUTABLE NAMES h5cc h5pcc @@ -80,6 +100,13 @@ find_program( HDF5_CXX_COMPILER_EXECUTABLE DOC "HDF5 C++ Wrapper compiler. Used only to detect HDF5 compile flags." ) mark_as_advanced( HDF5_CXX_COMPILER_EXECUTABLE ) +find_program( HDF5_Fortran_COMPILER_EXECUTABLE + NAMES h5fc h5pfc + HINTS ENV HDF5_ROOT + PATH_SUFFIXES bin Bin + DOC "HDF5 Fortran Wrapper compiler. Used only to detect HDF5 compile flags." ) +mark_as_advanced( HDF5_Fortran_COMPILER_EXECUTABLE ) + find_program( HDF5_DIFF_EXECUTABLE NAMES h5diff HINTS ENV HDF5_ROOT @@ -152,31 +179,39 @@ macro( _HDF5_parse_compile_line endforeach() endmacro() -if( HDF5_INCLUDE_DIRS AND HDF5_LIBRARIES ) - # Do nothing: we already have HDF5_INCLUDE_PATH and HDF5_LIBRARIES in the - # cache, it would be a shame to override them -else() - _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE ) - _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE ) - - if( NOT HDF5_FIND_COMPONENTS ) - set( HDF5_LANGUAGE_BINDINGS "C" ) - else() - # add the extra specified components, ensuring that they are valid. - foreach( component ${HDF5_FIND_COMPONENTS} ) - list( FIND HDF5_VALID_COMPONENTS ${component} component_location ) - if( ${component_location} EQUAL -1 ) - message( FATAL_ERROR - "\"${component}\" is not a valid HDF5 component." ) - else() - list( APPEND HDF5_LANGUAGE_BINDINGS ${component} ) +# Try to find HDF5 using an installed hdf5-config.cmake +if( NOT HDF5_FOUND ) + find_package( HDF5 QUIET NO_MODULE ) + if( HDF5_FOUND ) + set( HDF5_INCLUDE_DIRS ${HDF5_INCLUDE_DIR} ) + set( HDF5_LIBRARIES ) + set( HDF5_C_TARGET hdf5 ) + set( HDF5_CXX_TARGET hdf5_cpp ) + set( HDF5_HL_TARGET hdf5_hl ) + set( HDF5_Fortran_TARGET hdf5_fortran ) + foreach( _component ${HDF5_LANGUAGE_BINDINGS} ) + list( FIND HDF5_VALID_COMPONENTS ${_component} _component_location ) + get_target_property( _comp_location ${HDF5_${_component}_TARGET} LOCATION ) + if( _comp_location ) + set( HDF5_${_component}_LIBRARY ${_comp_location} CACHE PATH + "HDF5 ${_component} library" ) + mark_as_advanced( HDF5_${_component}_LIBRARY ) + list( APPEND HDF5_LIBRARIES ${HDF5_${_component}_LIBRARY} ) endif() endforeach() endif() - +endif() + +if( NOT HDF5_FOUND ) + _HDF5_invoke_compiler( C HDF5_C_COMPILE_LINE HDF5_C_RETURN_VALUE ) + _HDF5_invoke_compiler( CXX HDF5_CXX_COMPILE_LINE HDF5_CXX_RETURN_VALUE ) + _HDF5_invoke_compiler( Fortran HDF5_Fortran_COMPILE_LINE HDF5_Fortran_RETURN_VALUE ) + # seed the initial lists of libraries to find with items we know we need - set( HDF5_C_LIBRARY_NAMES_INIT hdf5_hl hdf5 ) + set( HDF5_C_LIBRARY_NAMES_INIT hdf5 ) + set( HDF5_HL_LIBRARY_NAMES_INIT hdf5_hl ${HDF5_C_LIBRARY_NAMES_INIT} ) set( HDF5_CXX_LIBRARY_NAMES_INIT hdf5_cpp ${HDF5_C_LIBRARY_NAMES_INIT} ) + set( HDF5_Fortran_LIBRARY_NAMES_INIT hdf5_fortran ${HDF5_C_LIBRARY_NAMES_INIT} ) foreach( LANGUAGE ${HDF5_LANGUAGE_BINDINGS} ) if( HDF5_${LANGUAGE}_COMPILE_LINE ) @@ -198,7 +233,13 @@ else() list( APPEND HDF5_DEFINITIONS ${HDF5_${LANGUAGE}_DEFINITIONS} ) # find the HDF5 include directories - find_path( HDF5_${LANGUAGE}_INCLUDE_DIR hdf5.h + if(${LANGUAGE} STREQUAL "Fortran") + set(HDF5_INCLUDE_FILENAME hdf5.mod) + else() + set(HDF5_INCLUDE_FILENAME hdf5.h) + endif() + + find_path( HDF5_${LANGUAGE}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME} HINTS ${HDF5_${LANGUAGE}_INCLUDE_FLAGS} ENV @@ -266,26 +307,41 @@ else() # We may have picked up some duplicates in various lists during the above # process for the language bindings (both the C and C++ bindings depend on - # libz for example). Remove the duplicates. + # libz for example). Remove the duplicates. It appears that the default + # CMake behavior is to remove duplicates from the end of a list. However, + # for link lines, this is incorrect since unresolved symbols are searched + # for down the link line. Therefore, we reverse the list, remove the + # duplicates, and then reverse it again to get the duplicates removed from + # the beginning. + macro( _remove_duplicates_from_beginning _list_name ) + list( REVERSE ${_list_name} ) + list( REMOVE_DUPLICATES ${_list_name} ) + list( REVERSE ${_list_name} ) + endmacro() + if( HDF5_INCLUDE_DIRS ) - list( REMOVE_DUPLICATES HDF5_INCLUDE_DIRS ) + _remove_duplicates_from_beginning( HDF5_INCLUDE_DIRS ) endif() if( HDF5_LIBRARIES_DEBUG ) - list( REMOVE_DUPLICATES HDF5_LIBRARIES_DEBUG ) + _remove_duplicates_from_beginning( HDF5_LIBRARIES_DEBUG ) endif() if( HDF5_LIBRARIES_RELEASE ) - list( REMOVE_DUPLICATES HDF5_LIBRARIES_RELEASE ) + _remove_duplicates_from_beginning( HDF5_LIBRARIES_RELEASE ) endif() if( HDF5_LIBRARY_DIRS ) - list( REMOVE_DUPLICATES HDF5_LIBRARY_DIRS ) + _remove_duplicates_from_beginning( HDF5_LIBRARY_DIRS ) endif() # Construct the complete list of HDF5 libraries with debug and optimized # variants when the generator supports them. if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE ) - set( HDF5_LIBRARIES - debug ${HDF5_LIBRARIES_DEBUG} - optimized ${HDF5_LIBRARIES_RELEASE} ) + set( HDF5_LIBRARIES ) + foreach( _lib ${HDF5_LIBRARIES_DEBUG} ) + list( APPEND HDF5_LIBRARIES debug ${_lib} ) + endforeach() + foreach( _lib ${HDF5_LIBRARIES_RELEASE} ) + list( APPEND HDF5_LIBRARIES optimized ${_lib} ) + endforeach() else() set( HDF5_LIBRARIES ${HDF5_LIBRARIES_RELEASE} ) endif() @@ -307,6 +363,12 @@ else() "HDF5 library compiled with parallel IO support" ) mark_as_advanced( HDF5_IS_PARALLEL ) + # For backwards compatibility we set HDF5_INCLUDE_DIR to the value of + # HDF5_INCLUDE_DIRS + if( HDF5_INCLUDE_DIRS ) + set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) + endif() + endif() find_package_handle_standard_args( HDF5 DEFAULT_MSG @@ -314,15 +376,3 @@ find_package_handle_standard_args( HDF5 DEFAULT_MSG HDF5_INCLUDE_DIRS ) -mark_as_advanced( - HDF5_INCLUDE_DIRS - HDF5_LIBRARIES - HDF5_DEFINTIONS - HDF5_LIBRARY_DIRS - HDF5_C_COMPILER_EXECUTABLE - HDF5_CXX_COMPILER_EXECUTABLE ) - -# For backwards compatibility we set HDF5_INCLUDE_DIR to the value of -# HDF5_INCLUDE_DIRS -set( HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIRS}" ) - diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index a6e6653..88ef7cd 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -1,15 +1,31 @@ # Locate and configure the Google Protocol Buffers library. +# +# The following variables can be set and are optional: +# +# PROTOBUF_SRC_ROOT_FOLDER - When compiling with MSVC, if this cache variable is set +# the protobuf-default VS project build locations +# (vsprojects/Debug & vsprojects/Release) will be searched +# for libraries and binaries. +# # Defines the following variables: # -# PROTOBUF_FOUND - Found the Google Protocol Buffers library +# PROTOBUF_FOUND - Found the Google Protocol Buffers library (libprotobuf & header files) # PROTOBUF_INCLUDE_DIRS - Include directories for Google Protocol Buffers -# PROTOBUF_LIBRARIES - The protobuf library +# PROTOBUF_LIBRARIES - The protobuf libraries +# [New in CMake 2.8.5] +# PROTOBUF_PROTOC_LIBRARIES - The protoc libraries +# PROTOBUF_LITE_LIBRARIES - The protobuf-lite libraries # -# The following cache variables are also defined: +# The following cache variables are also available to set or use: # PROTOBUF_LIBRARY - The protobuf library # PROTOBUF_PROTOC_LIBRARY - The protoc library # PROTOBUF_INCLUDE_DIR - The include directory for protocol buffers # PROTOBUF_PROTOC_EXECUTABLE - The protoc compiler +# [New in CMake 2.8.5] +# PROTOBUF_LIBRARY_DEBUG - The protobuf library (debug) +# PROTOBUF_PROTOC_LIBRARY_DEBUG - The protoc library (debug) +# PROTOBUF_LITE_LIBRARY - The protobuf lite library +# PROTOBUF_LITE_LIBRARY_DEBUG - The protobuf lite library (debug) # # ==================================================================== # Example: @@ -20,7 +36,7 @@ # include_directories(${CMAKE_CURRENT_BINARY_DIR}) # PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS foo.proto) # add_executable(bar bar.cc ${PROTO_SRCS} ${PROTO_HDRS}) -# target_link_libraries(bar ${PROTOBUF_LIBRARY}) +# target_link_libraries(bar ${PROTOBUF_LIBRARIES}) # # NOTE: You may need to link against pthreads, depending # on the platform. @@ -38,7 +54,7 @@ #============================================================================= # Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman <philip@yhbt.com> +# Copyright 2009-2011 Philip Lowman <philip@yhbt.com> # Copyright 2008 Esben Mose Hansen, Ange Optimization ApS # # Distributed under the OSI-approved BSD License (the "License"); @@ -81,41 +97,85 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) set(${HDRS} ${${HDRS}} PARENT_SCOPE) endfunction() +# Internal function: search for normal library as well as a debug one +# if the debug one is specified also include debug/optimized keywords +# in *_LIBRARIES variable +function(_protobuf_find_libraries name filename) + find_library(${name}_LIBRARY + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release) + mark_as_advanced(${name}_LIBRARY) + + find_library(${name}_LIBRARY_DEBUG + NAMES ${filename} + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug) + mark_as_advanced(${name}_LIBRARY_DEBUG) + + if(NOT ${name}_LIBRARY_DEBUG) + # There is no debug library + set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY} PARENT_SCOPE) + set(${name}_LIBRARIES ${${name}_LIBRARY} PARENT_SCOPE) + else() + # There IS a debug library + set(${name}_LIBRARIES + optimized ${${name}_LIBRARY} + debug ${${name}_LIBRARY_DEBUG} + PARENT_SCOPE + ) + endif() +endfunction() + -find_path(PROTOBUF_INCLUDE_DIR google/protobuf/service.h) +# +# Main. +# # Google's provided vcproj files generate libraries with a "lib" # prefix on Windows -if(WIN32) +if(MSVC) set(PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "") + + find_path(PROTOBUF_SRC_ROOT_FOLDER protobuf.pc.in) endif() -find_library(PROTOBUF_LIBRARY NAMES protobuf - DOC "The Google Protocol Buffers Library" -) -find_library(PROTOBUF_PROTOC_LIBRARY NAMES protoc - DOC "The Google Protocol Buffers Compiler Library" -) -find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc - DOC "The Google Protocol Buffers Compiler" -) +# The Protobuf library +_protobuf_find_libraries(PROTOBUF protobuf) +#DOC "The Google Protocol Buffers RELEASE Library" -mark_as_advanced(PROTOBUF_INCLUDE_DIR - PROTOBUF_LIBRARY - PROTOBUF_PROTOC_LIBRARY - PROTOBUF_PROTOC_EXECUTABLE) +_protobuf_find_libraries(PROTOBUF_LITE protobuf-lite) + +# The Protobuf Protoc Library +_protobuf_find_libraries(PROTOBUF_PROTOC protoc) # Restore original find library prefixes -if(WIN32) +if(MSVC) set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") endif() + +# Find the include directory +find_path(PROTOBUF_INCLUDE_DIR + google/protobuf/service.h + PATHS ${PROTOBUF_SRC_ROOT_FOLDER}/src +) +mark_as_advanced(PROTOBUF_INCLUDE_DIR) + +# Find the protoc Executable +find_program(PROTOBUF_PROTOC_EXECUTABLE + NAMES protoc + DOC "The Google Protocol Buffers Compiler" + PATHS + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Release + ${PROTOBUF_SRC_ROOT_FOLDER}/vsprojects/Debug +) +mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) + + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) if(PROTOBUF_FOUND) set(PROTOBUF_INCLUDE_DIRS ${PROTOBUF_INCLUDE_DIR}) - set(PROTOBUF_LIBRARIES ${PROTOBUF_LIBRARY}) endif() diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e284967..ca063d5 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -266,7 +266,7 @@ IF(UNIX) SET(SRCS ${SRCS} cmGlobalKdevelopGenerator.cxx) ENDIF(UNIX) -# XCode only works on apple +# Xcode only works on Apple IF(APPLE) SET(SRCS ${SRCS} cmXCodeObject.cxx diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 13a25cb..0612449 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -344,9 +344,21 @@ void cmCTestMemCheckHandler::GenerateDartOutput(std::ostream& os) } this->MemoryTesterGlobalResults[kk] += memcheckresults[kk]; } + + std::string logTag; + if(this->CTest->ShouldCompressMemCheckOutput()) + { + this->CTest->CompressString(memcheckstr); + logTag = "\t<Log compression=\"gzip\" encoding=\"base64\">\n"; + } + else + { + logTag = "\t<Log>\n"; + } + os << "\t\t</Results>\n" - << "\t<Log>\n" << memcheckstr << std::endl + << logTag << memcheckstr << std::endl << "\t</Log>\n"; this->WriteTestResultFooter(os, result); if ( current < cc ) diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 42a4cff..b5b46f6 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -135,7 +135,10 @@ void cmCTestRunTest::CompressOutput() //--------------------------------------------------------- bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) { - if (this->CTest->ShouldCompressTestOutput()) + if ((!this->TestHandler->MemCheck && + this->CTest->ShouldCompressTestOutput()) || + (this->TestHandler->MemCheck && + this->CTest->ShouldCompressMemCheckOutput())) { this->CompressOutput(); } @@ -279,11 +282,11 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // Output since that is what is parsed by cmCTestMemCheckHandler if(!this->TestHandler->MemCheck && started) { - this->TestHandler->CleanTestOutput(this->ProcessOutput, - static_cast<size_t> - (this->TestResult.Status == cmCTestTestHandler::COMPLETED ? - this->TestHandler->CustomMaximumPassedTestOutputSize : - this->TestHandler->CustomMaximumFailedTestOutputSize)); + this->TestHandler->CleanTestOutput(this->ProcessOutput, + static_cast<size_t> + (this->TestResult.Status == cmCTestTestHandler::COMPLETED ? + this->TestHandler->CustomMaximumPassedTestOutputSize : + this->TestHandler->CustomMaximumFailedTestOutputSize)); } this->TestResult.Reason = reason; if (this->TestHandler->LogFile) @@ -332,7 +335,8 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) // record the results in TestResult if(started) { - bool compress = this->CompressionRatio < 1 && + bool compress = !this->TestHandler->MemCheck && + this->CompressionRatio < 1 && this->CTest->ShouldCompressTestOutput(); this->TestResult.Output = compress ? this->CompressedOutput : this->ProcessOutput; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index bad26c5..56f6630 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1936,6 +1936,7 @@ void cmCTestTestHandler::SetTestsToRunInformation(const char* in) fin.getline(buff, filelen); buff[fin.gcount()] = 0; this->TestsToRunString = buff; + delete [] buff; } } diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index 411a28d..e237913 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -518,7 +518,7 @@ public: }; cmCPluginAPISourceFileMap cmCPluginAPISourceFiles; -void * CCONV cmCreateSourceFile() +void * CCONV cmCreateSourceFile(void) { return (void*)new cmCPluginAPISourceFile; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 70b1c01..75a564e 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -50,6 +50,9 @@ #include <memory> // auto_ptr +#include <cm_zlib.h> +#include <cmsys/Base64.h> + #if defined(__BEOS__) && !defined(__HAIKU__) #include <be/kernel/OS.h> /* disable_debugger() API. */ #endif @@ -308,7 +311,7 @@ cmCTest::cmCTest() this->UseHTTP10 = false; this->PrintLabels = false; this->CompressTestOutput = true; - this->ComputedCompressOutput = false; + this->CompressMemCheckOutput = true; this->TestModel = cmCTest::EXPERIMENTAL; this->MaxTestNameWidth = 30; this->InteractiveDebugMode = true; @@ -325,6 +328,8 @@ cmCTest::cmCTest() this->SuppressUpdatingCTestConfiguration = false; this->DartVersion = 1; this->OutputTestOutputOnTestFailure = false; + this->ComputedCompressTestOutput = false; + this->ComputedCompressMemCheckOutput = false; if(cmSystemTools::GetEnv("CTEST_OUTPUT_ON_FAILURE")) { this->OutputTestOutputOnTestFailure = true; @@ -394,7 +399,7 @@ void cmCTest::SetParallelLevel(int level) //---------------------------------------------------------------------------- bool cmCTest::ShouldCompressTestOutput() { - if(!this->ComputedCompressOutput) + if(!this->ComputedCompressTestOutput) { std::string cdashVersion = this->GetCDashVersion(); //version >= 1.6? @@ -403,12 +408,27 @@ bool cmCTest::ShouldCompressTestOutput() cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, cdashVersion.c_str(), "1.6"); this->CompressTestOutput &= cdashSupportsGzip; - this->ComputedCompressOutput = true; + this->ComputedCompressTestOutput = true; } return this->CompressTestOutput; } //---------------------------------------------------------------------------- +bool cmCTest::ShouldCompressMemCheckOutput() +{ + if(!this->ComputedCompressMemCheckOutput) + { + std::string cdashVersion = this->GetCDashVersion(); + + bool compressionSupported = cmSystemTools::VersionCompare( + cmSystemTools::OP_GREATER, cdashVersion.c_str(), "1.9.0"); + this->CompressMemCheckOutput &= compressionSupported; + this->ComputedCompressMemCheckOutput = true; + } + return this->CompressMemCheckOutput; +} + +//---------------------------------------------------------------------------- std::string cmCTest::GetCDashVersion() { #ifdef CMAKE_BUILD_WITH_CMAKE @@ -1926,6 +1946,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, if(this->CheckArgument(arg, "--no-compress-output")) { this->CompressTestOutput = false; + this->CompressMemCheckOutput = false; } if(this->CheckArgument(arg, "--print-labels")) @@ -3055,3 +3076,56 @@ void cmCTest::OutputTestErrors(std::vector<char> const &process_output) } cmCTestLog(this, HANDLER_OUTPUT, test_outputs << std::endl << std::flush); } + +//---------------------------------------------------------------------- +bool cmCTest::CompressString(std::string& str) +{ + int ret; + z_stream strm; + + unsigned char* in = reinterpret_cast<unsigned char*>( + const_cast<char*>(str.c_str())); + //zlib makes the guarantee that this is the maximum output size + int outSize = static_cast<int>( + static_cast<double>(str.size()) * 1.001 + 13.0); + unsigned char* out = new unsigned char[outSize]; + + strm.zalloc = Z_NULL; + strm.zfree = Z_NULL; + strm.opaque = Z_NULL; + ret = deflateInit(&strm, -1); //default compression level + if (ret != Z_OK) + { + return false; + } + + strm.avail_in = static_cast<uInt>(str.size()); + strm.next_in = in; + strm.avail_out = outSize; + strm.next_out = out; + ret = deflate(&strm, Z_FINISH); + + if(ret == Z_STREAM_ERROR || ret != Z_STREAM_END) + { + cmCTestLog(this, ERROR_MESSAGE, "Error during gzip compression." + << std::endl); + return false; + } + + (void)deflateEnd(&strm); + + // Now base64 encode the resulting binary string + unsigned char* base64EncodedBuffer + = new unsigned char[static_cast<int>(outSize * 1.5)]; + + unsigned long rlen + = cmsysBase64_Encode(out, strm.total_out, base64EncodedBuffer, 1); + + str = ""; + str.append(reinterpret_cast<char*>(base64EncodedBuffer), rlen); + + delete [] base64EncodedBuffer; + delete [] out; + + return true; +} diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 3b02748..44a5349 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -219,6 +219,8 @@ public: bool ShouldPrintLabels() { return this->PrintLabels; } bool ShouldCompressTestOutput(); + bool ShouldCompressMemCheckOutput(); + bool CompressString(std::string& str); std::string GetCDashVersion(); @@ -430,7 +432,8 @@ private: bool RunConfigurationScript; //flag for lazy getter (optimization) - bool ComputedCompressOutput; + bool ComputedCompressTestOutput; + bool ComputedCompressMemCheckOutput; int GenerateNotesFile(const char* files); @@ -487,8 +490,8 @@ private: bool ShortDateFormat; bool CompressXMLFiles; - bool CompressTestOutput; + bool CompressMemCheckOutput; void InitStreams(); std::ostream* StreamOut; diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index d28de08..9a3de9b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2614,6 +2614,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) ++i; long timeout = 0; + long inactivity_timeout = 0; std::string verboseLog; std::string statusVar; std::string expectedMD5sum; @@ -2634,6 +2635,19 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) return false; } } + else if(*i == "INACTIVITY_TIMEOUT") + { + ++i; + if(i != args.end()) + { + inactivity_timeout = atol(i->c_str()); + } + else + { + this->SetError("DOWNLOAD missing time for INACTIVITY_TIMEOUT."); + return false; + } + } else if(*i == "LOG") { ++i; @@ -2770,6 +2784,13 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) check_curl_result(res, "DOWNLOAD cannot set timeout: "); } + if(inactivity_timeout > 0) + { + // Give up if there is no progress for a long time. + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1); + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, inactivity_timeout); + } + // Need the progress helper's scope to last through the duration of // the curl_easy_perform call... so this object is declared at function // scope intentionally, rather than inside the "if(showProgress)" @@ -2883,6 +2904,7 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) ++i; long timeout = 0; + long inactivity_timeout = 0; std::string logVar; std::string statusVar; bool showProgress = false; @@ -2902,6 +2924,19 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) return false; } } + else if(*i == "INACTIVITY_TIMEOUT") + { + ++i; + if(i != args.end()) + { + inactivity_timeout = atol(i->c_str()); + } + else + { + this->SetError("UPLOAD missing time for INACTIVITY_TIMEOUT."); + return false; + } + } else if(*i == "LOG") { ++i; @@ -3003,6 +3038,13 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args) check_curl_result(res, "UPLOAD cannot set timeout: "); } + if(inactivity_timeout > 0) + { + // Give up if there is no progress for a long time. + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1); + ::curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, inactivity_timeout); + } + // Need the progress helper's scope to last through the duration of // the curl_easy_perform call... so this object is declared at function // scope intentionally, rather than inside the "if(showProgress)" diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 1b6dbbf..162890a 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -80,10 +80,11 @@ public: " file(RELATIVE_PATH variable directory file)\n" " file(TO_CMAKE_PATH path result)\n" " file(TO_NATIVE_PATH path result)\n" - " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log]\n" - " [EXPECTED_MD5 sum] [SHOW_PROGRESS])\n" - " file(UPLOAD filename url [TIMEOUT timeout] [STATUS status]\n" - " [LOG log] [SHOW_PROGRESS])\n" + " file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]\n" + " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" + " [EXPECTED_MD5 sum])\n" + " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" + " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " "overwrites the file if it already exists, and creates the file " "if it does not exist.\n" @@ -161,6 +162,8 @@ public: "numeric error means no error in the operation. " "If TIMEOUT time is specified, the operation will " "timeout after time seconds, time should be specified as an integer. " + "The INACTIVITY_TIMEOUT specifies an integer number of seconds of " + "inactivity after which the operation should terminate. " "If EXPECTED_MD5 sum is specified, the operation will verify that the " "downloaded file's actual md5 sum matches the expected value. If it " "does not match, the operation fails with an error. " @@ -176,6 +179,8 @@ public: "numeric error means no error in the operation. " "If TIMEOUT time is specified, the operation will " "timeout after time seconds, time should be specified as an integer. " + "The INACTIVITY_TIMEOUT specifies an integer number of seconds of " + "inactivity after which the operation should terminate. " "If SHOW_PROGRESS is specified, progress information will be printed " "as status messages until the operation is complete." "\n" diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d5c0fef..20eb50b 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -147,7 +147,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::New() } return gg.release(); #else - std::cerr << "CMake should be built with cmake to use XCode, " + std::cerr << "CMake should be built with cmake to use Xcode, " "default to Xcode 1.5\n"; return new cmGlobalXCodeGenerator; #endif @@ -323,6 +323,19 @@ void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root) } //---------------------------------------------------------------------------- +std::string +cmGlobalXCodeGenerator::PostBuildMakeTarget(std::string const& tName, + std::string const& configName) +{ + std::string out = "PostBuild." + tName; + if(this->XcodeVersion > 20) + { + out += "." + configName; + } + return out; +} + +//---------------------------------------------------------------------------- void cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, std::vector<cmLocalGenerator*>& gens) @@ -351,12 +364,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, makecommand.push_back(dir.c_str()); makecommand.push_back("-f"); makecommand.push_back(this->CurrentXCodeHackMakefile.c_str()); - if(this->XcodeVersion > 20) - { - makecommand.push_back("all.$(CONFIGURATION)"); - } - cmCustomCommandLines commandLines; - commandLines.push_back(makecommand); + makecommand.push_back(""); // placeholder, see below + // Add Re-Run CMake rules this->CreateReRunCMakeFile(root, gens); @@ -383,6 +392,10 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, target.GetType() == cmTarget::SHARED_LIBRARY || target.GetType() == cmTarget::MODULE_LIBRARY)) { + makecommand[makecommand.size()-1] = + this->PostBuildMakeTarget(target.GetName(), "$(CONFIGURATION)"); + cmCustomCommandLines commandLines; + commandLines.push_back(makecommand); lg->GetMakefile()->AddCustomCommandToTarget(target.GetName(), no_depends, commandLines, @@ -963,7 +976,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, this->CreateString("0")); } - // create list of build phases and create the XCode target + // create list of build phases and create the Xcode target cmXCodeObject* buildPhases = this->CreateObject(cmXCodeObject::OBJECT_LIST); @@ -2437,6 +2450,10 @@ void cmGlobalXCodeGenerator { linkLibs += li->Value; } + if(li->Target && !li->Target->IsImported()) + { + target->AddDependTarget(configName, li->Target->GetName()); + } } this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", linkLibs.c_str(), configName); @@ -2882,41 +2899,10 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( // correctly by xcode makefileStream << "# DO NOT EDIT\n"; makefileStream << "# This makefile makes sure all linkable targets are\n"; - makefileStream << "# up-to-date with anything they link to, avoiding a " - "bug in XCode 1.5\n"; - for(std::vector<std::string>::const_iterator - ct = this->CurrentConfigurationTypes.begin(); - ct != this->CurrentConfigurationTypes.end(); ++ct) - { - if(this->XcodeVersion < 21 || ct->empty()) - { - makefileStream << "all: "; - } - else - { - makefileStream << "all." << *ct << ": "; - } - const char* configName = 0; - if(!ct->empty()) - { - configName = ct->c_str(); - } - for(std::vector<cmXCodeObject*>::iterator i = targets.begin(); - i != targets.end(); ++i) - { - cmXCodeObject* target = *i; - cmTarget* t =target->GetTarget(); - if(t->GetType() == cmTarget::EXECUTABLE || - t->GetType() == cmTarget::SHARED_LIBRARY || - t->GetType() == cmTarget::MODULE_LIBRARY) - { - std::string tfull = t->GetFullPath(configName); - makefileStream << "\\\n\t" << - this->ConvertToRelativeForMake(tfull.c_str()); - } - } - makefileStream << "\n\n"; - } + makefileStream << "# up-to-date with anything they link to\n" + "default:\n" + "\techo \"Do not invoke directly\"\n" + "\n"; makefileStream << "# For each target create a dummy rule " "so the target does not have to exist\n"; @@ -2962,14 +2948,40 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( { cmXCodeObject* target = *i; cmTarget* t =target->GetTarget(); + + if(t->GetType() == cmTarget::EXECUTABLE || + t->GetType() == cmTarget::STATIC_LIBRARY || + t->GetType() == cmTarget::SHARED_LIBRARY || + t->GetType() == cmTarget::MODULE_LIBRARY) + { + // Declare an entry point for the target post-build phase. + makefileStream << this->PostBuildMakeTarget(t->GetName(), *ct) + << ":\n"; + } + if(t->GetType() == cmTarget::EXECUTABLE || t->GetType() == cmTarget::SHARED_LIBRARY || t->GetType() == cmTarget::MODULE_LIBRARY) { - // Create a rule for this target. std::string tfull = t->GetFullPath(configName); - makefileStream << this->ConvertToRelativeForMake(tfull.c_str()) - << ":"; + std::string trel = this->ConvertToRelativeForMake(tfull.c_str()); + + // Add this target to the post-build phases of its dependencies. + std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator + y = target->GetDependTargets().find(*ct); + if(y != target->GetDependTargets().end()) + { + std::vector<cmStdString> const& deptgts = y->second; + for(std::vector<cmStdString>::const_iterator d = deptgts.begin(); + d != deptgts.end(); ++d) + { + makefileStream << this->PostBuildMakeTarget(*d, *ct) << ": " + << trel << "\n"; + } + } + + // Create a rule for this target. + makefileStream << trel << ":"; // List dependencies if any exist. std::map<cmStdString, cmXCodeObject::StringVec>::const_iterator @@ -3112,7 +3124,7 @@ void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry) const { entry.Name = this->GetName(); - entry.Brief = "Generate XCode project files."; + entry.Brief = "Generate Xcode project files."; entry.Full = ""; } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 290532a..eec6df0 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -198,6 +198,8 @@ protected: std::vector<cmXCodeObject*> XCodeObjects; cmXCodeObject* RootObject; private: + std::string PostBuildMakeTarget(std::string const& tName, + std::string const& configName); cmXCodeObject* MainGroupChildren; cmXCodeObject* SourcesGroupChildren; cmXCodeObject* ResourcesGroupChildren; diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 3c74dc9..d239c06 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -677,7 +677,7 @@ bool cmStringCommand::HandleSubstringCommand(std::vector<std::string> const& if ( end < -1 || end > leftOverLength ) { cmOStringStream ostr; - ostr << "end index: " << end << " is out of range " << 0 << " - " + ostr << "end index: " << end << " is out of range -1 - " << leftOverLength; this->SetError(ostr.str().c_str()); return false; diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index 9586449..52b83d9 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -110,7 +110,8 @@ public: "a file.\n" "TOUPPER/TOLOWER will convert string to upper/lower characters.\n" "LENGTH will return a given string's length.\n" - "SUBSTRING will return a substring of a given string.\n" + "SUBSTRING will return a substring of a given string. If length is " + "-1 the remainder of the string starting at begin will be returned.\n" "STRIP will return a substring of a given string with leading " "and trailing spaces removed.\n" "RANDOM will return a random string of given length consisting of " diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index dc63568..c40e905 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2689,7 +2689,7 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op, else if(lhs[i] > rhs[i]) { // lhs > rhs, so true if operation is GREATER - return op == cmSystemTools::OP_GREATER; + return op == cmSystemTools::OP_GREATER; } } // lhs == rhs, so true if operation is EQUAL diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index ed0d60c..ae496ad 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -299,7 +299,12 @@ cmVisualStudioGeneratorOptions { fout << "<" << m->first << ">"; } - fout << m->second << "</" << m->first << ">\n"; + fout << m->second; + if (m->first == "AdditionalIncludeDirectories") + { + fout << ";%(AdditionalIncludeDirectories)"; + } + fout << "</" << m->first << ">\n"; } } else diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index bdb4f15..369fe66 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -139,6 +139,19 @@ public: { return this->DependLibraries; } + void AddDependTarget(const char* configName, + const char* tName) + { + if(!configName) + { + configName = ""; + } + this->DependTargets[configName].push_back(tName); + } + std::map<cmStdString, StringVec> const& GetDependTargets() + { + return this->DependTargets; + } std::vector<cmXCodeObject*> const& GetObjectList() { return this->List;} void SetComment(const char* c) { this->Comment = c;} static void PrintString(std::ostream& os,cmStdString String); @@ -156,6 +169,7 @@ protected: cmXCodeObject* PBXTargetDependencyValue; std::vector<cmXCodeObject*> List; std::map<cmStdString, StringVec> DependLibraries; + std::map<cmStdString, StringVec> DependTargets; std::map<cmStdString, cmXCodeObject*> ObjectAttributes; }; #endif diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index 4a17cef..8b46b4d 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -15,7 +15,7 @@ SET(KWSYS_DATE_STAMP_YEAR 2011) # KWSys version date month component. Format is MM. -SET(KWSYS_DATE_STAMP_MONTH 05) +SET(KWSYS_DATE_STAMP_MONTH 06) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 07) diff --git a/Tests/CFBundleTest/README.txt b/Tests/CFBundleTest/README.txt index 248651b..86c1463 100644 --- a/Tests/CFBundleTest/README.txt +++ b/Tests/CFBundleTest/README.txt @@ -1,5 +1,5 @@ -CFBundle test project. The generated .plugin/ bundle from either makefiles or XCode should look like this: +CFBundle test project. The generated .plugin/ bundle from either makefiles or Xcode should look like this: ./Contents ./Contents/Info.plist diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 8149847..1be2a24 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2061,6 +2061,18 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ ADD_TEST_MACRO(CompileCommandOutput "${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands") ENDIF() + + ADD_TEST(IncludeDirectories ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Tests/IncludeDirectories" + "${CMake_BINARY_DIR}/Tests/IncludeDirectories" + --build-two-config + --build-generator ${CMAKE_TEST_GENERATOR} + --build-project IncludeDirectories + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --test-command IncludeDirectories) + LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/IncludeDirectories") + ENDIF(BUILD_TESTING) SUBDIRS(CMakeTests) diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt new file mode 100644 index 0000000..60b8c22 --- /dev/null +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required (VERSION 2.6) +project(IncludeDirectories) + +file(WRITE ${CMAKE_BINARY_DIR}/Flags/Flags.h +"//Flags.h +") +file(WRITE ${CMAKE_BINARY_DIR}/IncDir/IncDir.h +"//IncDir.h +") +file(WRITE ${CMAKE_BINARY_DIR}/SrcProp/SrcProp.h +"//SrcProp.h +") +file(WRITE ${CMAKE_BINARY_DIR}/TarProp/TarProp.h +"//TarProp.h +") + +# default to testing with full path +# some compilers can not handle the escape for directories +# with spaces in them. +set(USE_FULLPATH TRUE) +if(WATCOM OR MSVC60) + set(USE_FULLPATH FALSE) +endif() +if(USE_FULLPATH) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \"-I${CMAKE_BINARY_DIR}/Flags\"") +else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -IFlags") +endif() + +include_directories(${CMAKE_BINARY_DIR}/IncDir) +if(USE_FULLPATH) + set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS + "\"-I${CMAKE_BINARY_DIR}/SrcProp\"") +else() + set_source_files_properties(main.cpp PROPERTIES COMPILE_FLAGS + "-ISrcProp") +endif() + +add_executable(IncludeDirectories main.cpp) + +if(USE_FULLPATH) + set_target_properties(IncludeDirectories + PROPERTIES COMPILE_FLAGS "\"-I${CMAKE_BINARY_DIR}/TarProp\"") +else() + set_target_properties(IncludeDirectories + PROPERTIES COMPILE_FLAGS "-ITarProp") +endif() diff --git a/Tests/IncludeDirectories/main.cpp b/Tests/IncludeDirectories/main.cpp new file mode 100644 index 0000000..a59d27c --- /dev/null +++ b/Tests/IncludeDirectories/main.cpp @@ -0,0 +1,9 @@ +#include "Flags.h" +#include "IncDir.h" +#include "SrcProp.h" +#include "TarProp.h" + +int main(int argc, char** argv) +{ + return 0; +} diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index 5fc6550..564db9f 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -294,7 +294,7 @@ ELSE(STAGE2) "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the XCode generator. + # Disable VERSION test until it is implemented in the Xcode generator. IF(NOT XCODE) SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) ENDIF(NOT XCODE) diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index 5fc6550..564db9f 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -294,7 +294,7 @@ ELSE(STAGE2) "${CMAKE_INSTALL_PREFIX}/InstallScriptOut.cmake;${CMAKE_INSTALL_PREFIX}/InstallScript4Out.cmake") SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES OUTPUT_NAME SimpleInstExe) - # Disable VERSION test until it is implemented in the XCode generator. + # Disable VERSION test until it is implemented in the Xcode generator. IF(NOT XCODE) SET_TARGET_PROPERTIES(SimpleInstall PROPERTIES VERSION 1.2) ENDIF(NOT XCODE) diff --git a/Tests/SourceGroups/CMakeLists.txt b/Tests/SourceGroups/CMakeLists.txt index e57e019..c3cf38c 100644 --- a/Tests/SourceGroups/CMakeLists.txt +++ b/Tests/SourceGroups/CMakeLists.txt @@ -5,7 +5,7 @@ project(SourceGroups) # it is more an example with several source_group() # commands. # The created projects have to be loaded manually -# in Visual Studio/XCode/Eclipse/... +# in Visual Studio/Xcode/Eclipse/... # to see whether the correct groups have been created. source_group(Base FILES main.c) diff --git a/Tests/TestsWorkingDirectory/CMakeLists.txt b/Tests/TestsWorkingDirectory/CMakeLists.txt index a0fd18a..6a6e9b6 100644 --- a/Tests/TestsWorkingDirectory/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/CMakeLists.txt @@ -23,7 +23,7 @@ set_tests_properties(WorkingDirectory2 PROPERTIES set(_default_cwd "${CMAKE_BINARY_DIR}") -# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +# FIXME: How to deal with /debug, /release, etc. with VS or Xcode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") add_test(WorkingDirectory3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd}) endif() @@ -34,7 +34,7 @@ string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_BINARY_DIR}") add_test(NAME WorkingDirectory5 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir}) -# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +# FIXME: How to deal with /debug, /release, etc. with VS or Xcode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") add_test(WorkingDirectory6 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) endif() diff --git a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt index 523f02e..c16b1db 100644 --- a/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt +++ b/Tests/TestsWorkingDirectory/subdir/CMakeLists.txt @@ -14,7 +14,7 @@ set_tests_properties(WorkingDirectory-Subdir2 PROPERTIES set(_default_cwd "${CMAKE_CURRENT_BINARY_DIR}") -# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +# FIXME: How to deal with /debug, /release, etc. with VS or Xcode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") add_test(WorkingDirectory-Subdir3 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd}) endif() @@ -25,7 +25,7 @@ string(REGEX REPLACE "/[^/]*$" "" _parent_dir "${CMAKE_CURRENT_BINARY_DIR}") add_test(NAME WorkingDirectory-Subdir5 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/.. COMMAND WorkingDirectory ${_parent_dir}) -# FIXME: How to deal with /debug, /release, etc. with VS or XCode? +# FIXME: How to deal with /debug, /release, etc. with VS or Xcode? if(${CMAKE_GENERATOR} MATCHES "Makefiles") add_test(WorkingDirectory-Subdir6 ${EXECUTABLE_OUTPUT_PATH}/WorkingDirectory ${_default_cwd} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/..) endif() |