Imported Upstream version 3.6.1
This commit is contained in:
parent
ff2e460c08
commit
696fa2e666
@ -308,3 +308,9 @@ Other Changes
|
||||
preferred future use is upper cased component names in variables.
|
||||
New variables that will be added to CPackRPM in later versions
|
||||
will only support upper cased component variable format.
|
||||
|
||||
* The CPack NSIS generator's configuration file template was fixed to
|
||||
quote the path to the uninstaller tool used by the
|
||||
:variable:`CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL` option.
|
||||
This avoids depending on an insecure Windows feature to run an
|
||||
uninstaller tool with a space in the path.
|
||||
|
@ -1803,6 +1803,7 @@ function(cpack_rpm_generate_package)
|
||||
endif()
|
||||
|
||||
cpack_rpm_variable_fallback("CPACK_RPM_FILE_NAME"
|
||||
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_FILE_NAME"
|
||||
"CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_FILE_NAME"
|
||||
"CPACK_RPM_FILE_NAME")
|
||||
if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT")
|
||||
|
@ -117,9 +117,11 @@ if(NOT HDF5_FIND_COMPONENTS)
|
||||
foreach(__lang IN LISTS __langs)
|
||||
if(__lang MATCHES "^(C|CXX|Fortran)$")
|
||||
list(APPEND HDF5_LANGUAGE_BINDINGS ${__lang})
|
||||
set(HDF5_FIND_REQUIRED_${__lang} True)
|
||||
endif()
|
||||
endforeach()
|
||||
set(FIND_HL ON)
|
||||
set(HDF5_FIND_REQUIRED_HL True)
|
||||
else()
|
||||
# add the extra specified components, ensuring that they are valid.
|
||||
set(FIND_HL OFF)
|
||||
@ -132,6 +134,9 @@ else()
|
||||
elseif(component STREQUAL "Fortran_HL") # only for compatibility
|
||||
list(APPEND HDF5_LANGUAGE_BINDINGS Fortran)
|
||||
set(FIND_HL ON)
|
||||
set(HDF5_FIND_REQUIRED_Fortran_HL False)
|
||||
set(HDF5_FIND_REQUIRED_Fortran True)
|
||||
set(HDF5_FIND_REQUIRED_HL True)
|
||||
else()
|
||||
message(FATAL_ERROR "${component} is not a valid HDF5 component.")
|
||||
endif()
|
||||
@ -144,6 +149,7 @@ else()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
list(REMOVE_ITEM HDF5_FIND_COMPONENTS Fortran_HL) # replaced by Fortran and HL
|
||||
list(REMOVE_DUPLICATES HDF5_LANGUAGE_BINDINGS)
|
||||
endif()
|
||||
|
||||
@ -267,8 +273,21 @@ endfunction()
|
||||
# return_value argument, the text output is stored to the output variable.
|
||||
macro( _HDF5_invoke_compiler language output return_value version)
|
||||
set(${version})
|
||||
if(HDF5_USE_STATIC_LIBRARIES)
|
||||
set(lib_type_args -noshlib)
|
||||
else()
|
||||
set(lib_type_args -shlib)
|
||||
endif()
|
||||
set(scratch_dir ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/hdf5)
|
||||
if("${language}" STREQUAL "C")
|
||||
set(test_file ${scratch_dir}/cmake_hdf5_test.c)
|
||||
elseif("${language}" STREQUAL "CXX")
|
||||
set(test_file ${scratch_dir}/cmake_hdf5_test.cxx)
|
||||
elseif("${language}" STREQUAL "Fortran")
|
||||
set(test_file ${scratch_dir}/cmake_hdf5_test.f90)
|
||||
endif()
|
||||
exec_program( ${HDF5_${language}_COMPILER_EXECUTABLE}
|
||||
ARGS -show
|
||||
ARGS -show ${lib_type_args} ${test_file}
|
||||
OUTPUT_VARIABLE ${output}
|
||||
RETURN_VALUE ${return_value}
|
||||
)
|
||||
@ -302,48 +321,67 @@ macro( _HDF5_parse_compile_line
|
||||
libraries_hl)
|
||||
|
||||
# Match the include paths
|
||||
string( REGEX MATCHALL "-I([^\" ]+)" include_path_flags
|
||||
"${${compile_line_var}}"
|
||||
)
|
||||
foreach( IPATH ${include_path_flags} )
|
||||
string( REGEX REPLACE "^-I" "" IPATH ${IPATH} )
|
||||
string( REPLACE "//" "/" IPATH ${IPATH} )
|
||||
set( RE " -I *([^\" ]+|\"[^\"]+\")")
|
||||
string( REGEX MATCHALL "${RE}" include_path_flags "${${compile_line_var}}")
|
||||
foreach( IPATH IN LISTS include_path_flags )
|
||||
string( REGEX REPLACE "${RE}" "\\1" IPATH "${IPATH}" )
|
||||
list( APPEND ${include_paths} ${IPATH} )
|
||||
endforeach()
|
||||
|
||||
# Match the definitions
|
||||
string( REGEX MATCHALL "-D[^ ]*" definition_flags "${${compile_line_var}}" )
|
||||
foreach( DEF ${definition_flags} )
|
||||
set( RE " -D([^ ]*)")
|
||||
string( REGEX MATCHALL "${RE}" definition_flags "${${compile_line_var}}" )
|
||||
foreach( DEF IN LISTS definition_flags )
|
||||
string( REGEX REPLACE "${RE}" "\\1" DEF "${DEF}" )
|
||||
list( APPEND ${definitions} ${DEF} )
|
||||
endforeach()
|
||||
|
||||
# Match the library paths
|
||||
string( REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" library_path_flags
|
||||
"${${compile_line_var}}"
|
||||
)
|
||||
|
||||
foreach( LPATH ${library_path_flags} )
|
||||
string( REGEX REPLACE "^-L" "" LPATH ${LPATH} )
|
||||
string( REPLACE "//" "/" LPATH ${LPATH} )
|
||||
set( RE " -L *([^\" ]+|\"[^\"]+\")")
|
||||
string( REGEX MATCHALL "${RE}" library_path_flags "${${compile_line_var}}")
|
||||
foreach( LPATH IN LISTS library_path_flags )
|
||||
string( REGEX REPLACE "${RE}" "\\1" LPATH "${LPATH}" )
|
||||
list( APPEND ${library_paths} ${LPATH} )
|
||||
endforeach()
|
||||
|
||||
# now search for the library names specified in the compile line (match -l...)
|
||||
# now search for the lib names specified in the compile line (match -l...)
|
||||
# match only -l's preceded by a space or comma
|
||||
# this is to exclude directory names like xxx-linux/
|
||||
string( REGEX MATCHALL "[, ]-l([^\", ]+)" library_name_flags
|
||||
"${${compile_line_var}}" )
|
||||
# strip the -l from all of the library flags and add to the search list
|
||||
foreach( LIB ${library_name_flags} )
|
||||
string( REGEX REPLACE "^[, ]-l" "" LIB ${LIB} )
|
||||
if(LIB MATCHES ".*_hl")
|
||||
list(APPEND ${libraries_hl} ${LIB})
|
||||
set( RE " -l *([^\" ]+|\"[^\"]+\")")
|
||||
string( REGEX MATCHALL "${RE}" library_name_flags "${${compile_line_var}}")
|
||||
foreach( LNAME IN LISTS library_name_flags )
|
||||
string( REGEX REPLACE "${RE}" "\\1" LNAME "${LNAME}" )
|
||||
if(LNAME MATCHES ".*hl")
|
||||
list(APPEND ${libraries_hl} ${LNAME})
|
||||
else()
|
||||
list(APPEND ${libraries} ${LIB})
|
||||
list(APPEND ${libraries} ${LNAME})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# now search for full library paths with no flags
|
||||
set( RE " ([^\" ]+|\"[^\"]+\")")
|
||||
string( REGEX MATCHALL "${RE}" library_name_noflags "${${compile_line_var}}")
|
||||
foreach( LIB IN LISTS library_name_noflags )
|
||||
string( REGEX REPLACE "${RE}" "\\1" LIB "${LIB}" )
|
||||
get_filename_component(LIB "${LIB}" ABSOLUTE)
|
||||
if(NOT EXISTS ${LIB} OR IS_DIRECTORY ${LIB})
|
||||
continue()
|
||||
endif()
|
||||
get_filename_component(LPATH ${LIB} DIRECTORY)
|
||||
get_filename_component(LNAME ${LIB} NAME_WE)
|
||||
string( REGEX REPLACE "^lib" "" LNAME ${LNAME} )
|
||||
list( APPEND ${library_paths} ${LPATH} )
|
||||
if(LNAME MATCHES ".*hl")
|
||||
list(APPEND ${libraries_hl} ${LNAME})
|
||||
else()
|
||||
list(APPEND ${libraries} ${LNAME})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
if(NOT HDF5_ROOT)
|
||||
set(HDF5_ROOT $ENV{HDF5_ROOT})
|
||||
endif()
|
||||
|
||||
# Try to find HDF5 using an installed hdf5-config.cmake
|
||||
if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
find_package(HDF5 QUIET NO_MODULE)
|
||||
@ -382,6 +420,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
mark_as_advanced(HDF5_${_lang}_LIBRARY)
|
||||
list(APPEND HDF5_LIBRARIES ${HDF5_${_lang}_LIBRARY})
|
||||
set(HDF5_${_lang}_LIBRARIES ${HDF5_${_lang}_LIBRARY})
|
||||
set(HDF5_${_lang}_FOUND True)
|
||||
endif()
|
||||
if(FIND_HL)
|
||||
get_target_property(_lang_hl_location ${HDF5_${_lang}_HL_TARGET}${_suffix} LOCATION)
|
||||
@ -391,6 +430,7 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
mark_as_advanced(HDF5_${_lang}_HL_LIBRARY)
|
||||
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
|
||||
set(HDF5_${_lang}_HL_LIBRARIES ${HDF5_${_lang}_HL_LIBRARY})
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
@ -433,13 +473,15 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
|
||||
mark_as_advanced(HDF5_${__lang}_LIBRARIES)
|
||||
mark_as_advanced(HDF5_${__lang}_HL_LIBRARIES)
|
||||
|
||||
set(HDF5_${__lang}_FOUND True)
|
||||
set(HDF5_HL_FOUND True)
|
||||
else()
|
||||
set(HDF5_COMPILER_NO_INTERROGATE False)
|
||||
# If this language isn't using the wrapper, then try to seed the
|
||||
# search options with the wrapper
|
||||
find_program(HDF5_${__lang}_COMPILER_EXECUTABLE
|
||||
NAMES ${HDF5_${__lang}_COMPILER_NAMES} NAMES_PER_DIR
|
||||
HINTS ENV HDF5_ROOT
|
||||
PATH_SUFFIXES bin Bin
|
||||
DOC "HDF5 ${__lang} Wrapper compiler. Used only to detect HDF5 compile flags."
|
||||
)
|
||||
@ -459,6 +501,14 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
HDF5_${__lang}_HL_LIBRARY_NAMES
|
||||
)
|
||||
set(HDF5_${__lang}_LIBRARIES)
|
||||
|
||||
set(_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
if(HDF5_USE_STATIC_LIBRARIES)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
else()
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||
endif()
|
||||
|
||||
foreach(L IN LISTS HDF5_${__lang}_LIBRARY_NAMES)
|
||||
find_library(HDF5_${__lang}_LIBRARY_${L} ${L} ${HDF5_${__lang}_LIBRARY_DIRS})
|
||||
if(HDF5_${__lang}_LIBRARY_${L})
|
||||
@ -477,7 +527,11 @@ if(NOT HDF5_FOUND AND NOT HDF5_ROOT)
|
||||
list(APPEND HDF5_${__lang}_HL_LIBRARIES ${L})
|
||||
endif()
|
||||
endforeach()
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_HDF5_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
set(HDF5_${__lang}_FOUND True)
|
||||
mark_as_advanced(HDF5_${__lang}_DEFINITIONS)
|
||||
mark_as_advanced(HDF5_${__lang}_INCLUDE_DIRS)
|
||||
@ -539,10 +593,14 @@ elseif(NOT HDF5_FOUND AND NOT _HDF5_NEED_TO_SEARCH)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HDF5_ROOT)
|
||||
set(SEARCH_OPTS NO_DEFAULT_PATH)
|
||||
endif()
|
||||
find_program( HDF5_DIFF_EXECUTABLE
|
||||
NAMES h5diff
|
||||
HINTS ENV HDF5_ROOT
|
||||
HINTS ${HDF5_ROOT}
|
||||
PATH_SUFFIXES bin Bin
|
||||
${SEARCH_OPTS}
|
||||
DOC "HDF5 file differencing tool." )
|
||||
mark_as_advanced( HDF5_DIFF_EXECUTABLE )
|
||||
|
||||
@ -557,9 +615,6 @@ if( NOT HDF5_FOUND )
|
||||
set(HDF5_Fortran_LIBRARY_NAMES hdf5_fortran ${HDF5_C_LIBRARY_NAMES})
|
||||
set(HDF5_Fortran_HL_LIBRARY_NAMES hdf5_hl_fortran ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_Fortran_LIBRARY_NAMES})
|
||||
|
||||
if(HDF5_ROOT)
|
||||
set(SEARCH_OPTS NO_DEFAULT_PATH)
|
||||
endif()
|
||||
foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
|
||||
# find the HDF5 include directories
|
||||
if(LANGUAGE STREQUAL "Fortran")
|
||||
@ -571,7 +626,7 @@ if( NOT HDF5_FOUND )
|
||||
endif()
|
||||
|
||||
find_path(HDF5_${__lang}_INCLUDE_DIR ${HDF5_INCLUDE_FILENAME}
|
||||
HINTS ${HDF5_ROOT} ENV HDF5_ROOT
|
||||
HINTS ${HDF5_ROOT}
|
||||
PATHS $ENV{HOME}/.local/include
|
||||
PATH_SUFFIXES include Include
|
||||
${SEARCH_OPTS}
|
||||
@ -597,17 +652,20 @@ if( NOT HDF5_FOUND )
|
||||
endif()
|
||||
find_library(HDF5_${LIB}_LIBRARY_DEBUG
|
||||
NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
|
||||
HINTS ${HDF5_ROOT} ENV HDF5_ROOT PATH_SUFFIXES lib Lib
|
||||
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
|
||||
${SEARCH_OPTS}
|
||||
)
|
||||
find_library( HDF5_${LIB}_LIBRARY_RELEASE
|
||||
NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
|
||||
HINTS ${HDF5_ROOT} ENV HDF5_ROOT PATH_SUFFIXES lib Lib
|
||||
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
|
||||
${SEARCH_OPTS}
|
||||
)
|
||||
select_library_configurations( HDF5_${LIB} )
|
||||
list(APPEND HDF5_${__lang}_LIBRARIES ${HDF5_${LIB}_LIBRARY})
|
||||
eNdforeach()
|
||||
endforeach()
|
||||
if(HDF5_${__lang}_LIBRARIES)
|
||||
set(HDF5_${__lang}_FOUND True)
|
||||
endif()
|
||||
|
||||
# Append the libraries for this language binding to the list of all
|
||||
# required libraries.
|
||||
@ -631,12 +689,12 @@ if( NOT HDF5_FOUND )
|
||||
endif()
|
||||
find_library(HDF5_${LIB}_LIBRARY_DEBUG
|
||||
NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
|
||||
HINTS ${HDF5_ROOT} ENV HDF5_ROOT PATH_SUFFIXES lib Lib
|
||||
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
|
||||
${SEARCH_OPTS}
|
||||
)
|
||||
find_library( HDF5_${LIB}_LIBRARY_RELEASE
|
||||
NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
|
||||
HINTS ${HDF5_ROOT} ENV HDF5_ROOT PATH_SUFFIXES lib Lib
|
||||
HINTS ${HDF5_ROOT} PATH_SUFFIXES lib Lib
|
||||
${SEARCH_OPTS}
|
||||
)
|
||||
select_library_configurations( HDF5_${LIB} )
|
||||
@ -648,6 +706,9 @@ if( NOT HDF5_FOUND )
|
||||
list(APPEND HDF5_HL_LIBRARIES ${HDF5_${__lang}_HL_LIBRARIES})
|
||||
endif()
|
||||
endforeach()
|
||||
if(FIND_HL AND HDF5_HL_LIBRARIES)
|
||||
set(HDF5_HL_FOUND True)
|
||||
endif()
|
||||
|
||||
_HDF5_remove_duplicates_from_beginning(HDF5_INCLUDE_DIRS)
|
||||
_HDF5_remove_duplicates_from_beginning(HDF5_LIBRARIES)
|
||||
@ -707,4 +768,5 @@ endif()
|
||||
find_package_handle_standard_args(HDF5
|
||||
REQUIRED_VARS ${HDF5_REQUIRED_VARS}
|
||||
VERSION_VAR HDF5_VERSION
|
||||
HANDLE_COMPONENTS
|
||||
)
|
||||
|
@ -920,7 +920,7 @@ uninst:
|
||||
ClearErrors
|
||||
StrLen $2 "\Uninstall.exe"
|
||||
StrCpy $3 $0 -$2 # remove "\Uninstall.exe" from UninstallString to get path
|
||||
ExecWait '$0 _?=$3' ;Do not copy the uninstaller to a temp file
|
||||
ExecWait '"$0" _?=$3' ;Do not copy the uninstaller to a temp file
|
||||
|
||||
IfErrors uninst_failed inst
|
||||
uninst_failed:
|
||||
|
@ -1,5 +1,5 @@
|
||||
# CMake version number components.
|
||||
set(CMake_VERSION_MAJOR 3)
|
||||
set(CMake_VERSION_MINOR 6)
|
||||
set(CMake_VERSION_PATCH 0)
|
||||
set(CMake_VERSION_PATCH 1)
|
||||
#set(CMake_VERSION_RC 0)
|
||||
|
@ -625,7 +625,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
||||
cmGlobalGenerator gg(&cm);
|
||||
cmsys::auto_ptr<cmMakefile> mf(
|
||||
new cmMakefile(&gg, cm.GetCurrentSnapshot()));
|
||||
if (!installSubDirectory.empty() && installSubDirectory != "/") {
|
||||
if (!installSubDirectory.empty() && installSubDirectory != "/" &&
|
||||
installSubDirectory != ".") {
|
||||
tempInstallDirectory += installSubDirectory;
|
||||
}
|
||||
if (componentInstall) {
|
||||
|
@ -226,12 +226,10 @@ void cmFindBase::FillSystemEnvironmentPath()
|
||||
paths.AddEnvPath(this->EnvironmentPath);
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
paths.AddEnvPrefixPath("PATH", true);
|
||||
paths.AddEnvPath("PATH");
|
||||
#endif
|
||||
} else {
|
||||
// Add PATH
|
||||
paths.AddEnvPath("PATH");
|
||||
}
|
||||
// Add PATH
|
||||
paths.AddEnvPath("PATH");
|
||||
paths.AddSuffixes(this->SearchPathSuffixes);
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ static int calculateCommandLineLengthLimit(int linkRuleLength)
|
||||
size_t const arrSz = cmArraySize(limits);
|
||||
int const sz = *std::min_element(limits, limits + arrSz);
|
||||
if (sz == std::numeric_limits<int>::max()) {
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sz - linkRuleLength;
|
||||
|
@ -25,79 +25,6 @@
|
||||
#include "cmGlobalVisualStudioGenerator.h"
|
||||
#endif
|
||||
|
||||
static std::string GetAutogenTargetName(cmGeneratorTarget const* target)
|
||||
{
|
||||
std::string autogenTargetName = target->GetName();
|
||||
autogenTargetName += "_automoc";
|
||||
return autogenTargetName;
|
||||
}
|
||||
|
||||
static std::string GetAutogenTargetDir(cmGeneratorTarget const* target)
|
||||
{
|
||||
cmMakefile* makefile = target->Target->GetMakefile();
|
||||
std::string targetDir = makefile->GetCurrentBinaryDirectory();
|
||||
targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
|
||||
targetDir += "/";
|
||||
targetDir += GetAutogenTargetName(target);
|
||||
targetDir += ".dir/";
|
||||
return targetDir;
|
||||
}
|
||||
|
||||
static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
|
||||
{
|
||||
cmMakefile* makefile = target->Target->GetMakefile();
|
||||
std::string targetDir = makefile->GetCurrentBinaryDirectory();
|
||||
targetDir += "/";
|
||||
targetDir += GetAutogenTargetName(target);
|
||||
targetDir += ".dir/";
|
||||
return targetDir;
|
||||
}
|
||||
|
||||
static std::string GetSourceRelativePath(cmGeneratorTarget const* target,
|
||||
const std::string& fileName)
|
||||
{
|
||||
std::string pathRel;
|
||||
// Test if the file is child to any of the known directories
|
||||
{
|
||||
const std::string fileNameReal = cmsys::SystemTools::GetRealPath(fileName);
|
||||
std::string parentDirectory;
|
||||
bool match(false);
|
||||
{
|
||||
std::string testDirs[4];
|
||||
{
|
||||
cmMakefile* makefile = target->Target->GetMakefile();
|
||||
testDirs[0] = makefile->GetCurrentSourceDirectory();
|
||||
testDirs[1] = makefile->GetCurrentBinaryDirectory();
|
||||
testDirs[2] = makefile->GetHomeDirectory();
|
||||
testDirs[3] = makefile->GetHomeOutputDirectory();
|
||||
}
|
||||
for (int ii = 0; ii != sizeof(testDirs) / sizeof(std::string); ++ii) {
|
||||
const ::std::string testDir =
|
||||
cmsys::SystemTools::GetRealPath(testDirs[ii]);
|
||||
if (!testDir.empty() &&
|
||||
cmsys::SystemTools::IsSubDirectory(fileNameReal, testDir)) {
|
||||
parentDirectory = testDir;
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Use root as fallback parent directory
|
||||
if (!match) {
|
||||
cmsys::SystemTools::SplitPathRootComponent(fileNameReal,
|
||||
&parentDirectory);
|
||||
}
|
||||
pathRel = cmsys::SystemTools::RelativePath(
|
||||
parentDirectory, cmsys::SystemTools::GetParentDirectory(fileNameReal));
|
||||
}
|
||||
// Sanitize relative path
|
||||
if (!pathRel.empty()) {
|
||||
pathRel += '/';
|
||||
cmSystemTools::ReplaceString(pathRel, "..", "__");
|
||||
}
|
||||
return pathRel;
|
||||
}
|
||||
|
||||
static void SetupSourceFiles(cmGeneratorTarget const* target,
|
||||
std::vector<std::string>& skipMoc,
|
||||
std::vector<std::string>& mocSources,
|
||||
@ -128,16 +55,13 @@ static void SetupSourceFiles(cmGeneratorTarget const* target,
|
||||
if (target->GetPropertyAsBool("AUTORCC")) {
|
||||
if (ext == "qrc" &&
|
||||
!cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
|
||||
|
||||
std::string rcc_output_dir = GetAutogenTargetBuildDir(target);
|
||||
rcc_output_dir += GetSourceRelativePath(target, absFile);
|
||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||
|
||||
std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
|
||||
|
||||
std::string rcc_output_dir = target->GetSupportDirectory();
|
||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||
std::string rcc_output_file = rcc_output_dir;
|
||||
rcc_output_file += "qrc_" + basename + ".cpp";
|
||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
|
||||
rcc_output_file.c_str(), false);
|
||||
makefile->GetOrCreateSource(rcc_output_file, true);
|
||||
@ -441,6 +365,24 @@ static void MergeRccOptions(std::vector<std::string>& opts,
|
||||
opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
|
||||
}
|
||||
|
||||
std::string GetAutogenTargetName(cmGeneratorTarget const* target)
|
||||
{
|
||||
std::string autogenTargetName = target->GetName();
|
||||
autogenTargetName += "_automoc";
|
||||
return autogenTargetName;
|
||||
}
|
||||
|
||||
std::string GetAutogenTargetDir(cmGeneratorTarget const* target)
|
||||
{
|
||||
cmMakefile* makefile = target->Target->GetMakefile();
|
||||
std::string targetDir = makefile->GetCurrentBinaryDirectory();
|
||||
targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
|
||||
targetDir += "/";
|
||||
targetDir += GetAutogenTargetName(target);
|
||||
targetDir += ".dir/";
|
||||
return targetDir;
|
||||
}
|
||||
|
||||
static void copyTargetProperty(cmTarget* destinationTarget,
|
||||
cmTarget* sourceTarget,
|
||||
const std::string& propertyName)
|
||||
@ -803,18 +745,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
||||
if (target->GetPropertyAsBool("AUTORCC")) {
|
||||
if (ext == "qrc" &&
|
||||
!cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"))) {
|
||||
std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
|
||||
|
||||
{
|
||||
std::string rcc_output_dir = GetAutogenTargetBuildDir(target);
|
||||
rcc_output_dir += GetSourceRelativePath(target, absFile);
|
||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||
|
||||
std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(absFile);
|
||||
std::string rcc_output_file = rcc_output_dir;
|
||||
rcc_output_file += "qrc_" + basename + ".cpp";
|
||||
rcc_output.push_back(rcc_output_file);
|
||||
}
|
||||
std::string rcc_output_dir = target->GetSupportDirectory();
|
||||
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
|
||||
std::string rcc_output_file = rcc_output_dir;
|
||||
rcc_output_file += "/qrc_" + basename + ".cpp";
|
||||
rcc_output.push_back(rcc_output_file);
|
||||
|
||||
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
|
||||
if (qtMajorVersion == "5") {
|
||||
|
@ -358,12 +358,11 @@ void cmQtAutoGenerators::WriteOldMocDefinitionsFile(
|
||||
|
||||
void cmQtAutoGenerators::Init()
|
||||
{
|
||||
this->TargetBuildSubDir = this->TargetName;
|
||||
this->TargetBuildSubDir += ".dir/";
|
||||
|
||||
this->OutMocCppFilenameRel = this->TargetName;
|
||||
this->OutMocCppFilenameRel += ".cpp";
|
||||
this->OutMocCppFilenameAbs = this->Builddir + this->OutMocCppFilenameRel;
|
||||
|
||||
this->OutMocCppFilename = this->Builddir;
|
||||
this->OutMocCppFilename += this->OutMocCppFilenameRel;
|
||||
|
||||
std::vector<std::string> cdefList;
|
||||
cmSystemTools::ExpandListArgument(this->MocCompileDefinitionsStr, cdefList);
|
||||
@ -440,7 +439,7 @@ static std::string ReadAll(const std::string& filename)
|
||||
|
||||
bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
|
||||
{
|
||||
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilenameAbs.c_str()) ||
|
||||
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str()) ||
|
||||
(this->OldCompileSettingsStr != this->CurrentCompileSettingsStr)) {
|
||||
this->GenerateAll = true;
|
||||
}
|
||||
@ -948,13 +947,12 @@ void cmQtAutoGenerators::ParseHeaders(
|
||||
this->LogInfo(err.str());
|
||||
}
|
||||
|
||||
const std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName);
|
||||
|
||||
const std::string currentMoc = "moc_" + basename + ".cpp";
|
||||
std::string macroName;
|
||||
if (requiresMocing(contents, macroName)) {
|
||||
const std::string parentDir =
|
||||
this->TargetBuildSubDir + this->SourceRelativePath(headerName);
|
||||
const std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(headerName);
|
||||
const std::string currentMoc = parentDir + "moc_" + basename + ".cpp";
|
||||
notIncludedMocs[headerName] = currentMoc;
|
||||
}
|
||||
}
|
||||
@ -1032,7 +1030,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
|
||||
// check if we even need to update _automoc.cpp
|
||||
if (!automocCppChanged) {
|
||||
// compare contents of the _automoc.cpp file
|
||||
const std::string oldContents = ReadAll(this->OutMocCppFilenameAbs);
|
||||
const std::string oldContents = ReadAll(this->OutMocCppFilename);
|
||||
if (oldContents == automocSource) {
|
||||
// nothing changed: don't touch the _automoc.cpp file
|
||||
if (this->Verbose) {
|
||||
@ -1055,7 +1053,7 @@ bool cmQtAutoGenerators::GenerateMocFiles(
|
||||
}
|
||||
{
|
||||
cmsys::ofstream outfile;
|
||||
outfile.open(this->OutMocCppFilenameAbs.c_str(), std::ios::trunc);
|
||||
outfile.open(this->OutMocCppFilename.c_str(), std::ios::trunc);
|
||||
outfile << automocSource;
|
||||
outfile.close();
|
||||
}
|
||||
@ -1264,10 +1262,8 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
|
||||
if (ext == ".qrc") {
|
||||
std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(*si);
|
||||
std::string qrcOutputFile = this->TargetBuildSubDir +
|
||||
this->SourceRelativePath(*si) + "qrc_" + basename + ".cpp";
|
||||
// std::string qrcOutputFile = "CMakeFiles/" + this->OriginTargetName
|
||||
// + ".dir/qrc_" + basename + ".cpp";
|
||||
std::string qrcOutputFile = "CMakeFiles/" + this->OriginTargetName +
|
||||
".dir/qrc_" + basename + ".cpp";
|
||||
qrcGenMap[*si] = qrcOutputFile;
|
||||
}
|
||||
}
|
||||
@ -1302,10 +1298,8 @@ bool cmQtAutoGenerators::GenerateQrcFiles()
|
||||
bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
|
||||
const std::string& qrcOutputFile)
|
||||
{
|
||||
std::string relName = this->SourceRelativePath(qrcInputFile);
|
||||
std::replace(relName.begin(), relName.end(), '/', '_');
|
||||
relName += cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
|
||||
|
||||
const std::string basename =
|
||||
cmsys::SystemTools::GetFilenameWithoutLastExtension(qrcInputFile);
|
||||
const ::std::string qrcBuildFile = this->Builddir + qrcOutputFile;
|
||||
|
||||
int sourceNewerThanQrc = 0;
|
||||
@ -1332,7 +1326,7 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
|
||||
}
|
||||
|
||||
command.push_back("-name");
|
||||
command.push_back(relName);
|
||||
command.push_back(basename);
|
||||
command.push_back("-o");
|
||||
command.push_back(qrcBuildFile);
|
||||
command.push_back(qrcInputFile);
|
||||
@ -1357,49 +1351,6 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile,
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string cmQtAutoGenerators::SourceRelativePath(const std::string& filename)
|
||||
{
|
||||
std::string pathRel;
|
||||
|
||||
// Test if the file is child to any of the known directories
|
||||
{
|
||||
std::string fileNameReal = cmsys::SystemTools::GetRealPath(filename);
|
||||
std::string parentDirectory;
|
||||
bool match(false);
|
||||
{
|
||||
const ::std::string* testDirs[4];
|
||||
testDirs[0] = &(this->Srcdir);
|
||||
testDirs[1] = &(this->Builddir);
|
||||
testDirs[2] = &(this->ProjectSourceDir);
|
||||
testDirs[3] = &(this->ProjectBinaryDir);
|
||||
for (int ii = 0; ii != sizeof(testDirs) / sizeof(const ::std::string*);
|
||||
++ii) {
|
||||
const ::std::string testDir =
|
||||
cmsys::SystemTools::GetRealPath(*(testDirs[ii]));
|
||||
if (cmsys::SystemTools::IsSubDirectory(fileNameReal, testDir)) {
|
||||
parentDirectory = testDir;
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Use root as fallback parent directory
|
||||
if (!match) {
|
||||
cmsys::SystemTools::SplitPathRootComponent(fileNameReal,
|
||||
&parentDirectory);
|
||||
}
|
||||
pathRel = cmsys::SystemTools::RelativePath(
|
||||
parentDirectory, cmsys::SystemTools::GetParentDirectory(fileNameReal));
|
||||
}
|
||||
|
||||
// Sanitize relative path
|
||||
if (!pathRel.empty()) {
|
||||
pathRel += '/';
|
||||
cmSystemTools::ReplaceString(pathRel, "..", "__");
|
||||
}
|
||||
return pathRel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Collects name collisions as output/input pairs
|
||||
* @return True if there were collisions
|
||||
|
@ -83,8 +83,6 @@ private:
|
||||
|
||||
void Init();
|
||||
|
||||
std::string SourceRelativePath(const std::string& filename);
|
||||
|
||||
bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
|
||||
std::multimap<std::string, std::string>& collisions);
|
||||
void NameCollisionLog(
|
||||
@ -125,9 +123,8 @@ private:
|
||||
std::string CurrentCompileSettingsStr;
|
||||
std::string OldCompileSettingsStr;
|
||||
|
||||
std::string TargetBuildSubDir;
|
||||
std::string OutMocCppFilenameRel;
|
||||
std::string OutMocCppFilenameAbs;
|
||||
std::string OutMocCppFilename;
|
||||
std::list<std::string> MocIncludes;
|
||||
std::list<std::string> MocDefinitions;
|
||||
std::vector<std::string> MocOptions;
|
||||
|
@ -2354,7 +2354,8 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
|
||||
cmGlobalVisualStudio10Generator* gg =
|
||||
static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
|
||||
const char* toolset = gg->GetPlatformToolset();
|
||||
if (toolset && (cmHasLiteralPrefix(toolset, "v100") ||
|
||||
if (toolset && (cmHasLiteralPrefix(toolset, "v90") ||
|
||||
cmHasLiteralPrefix(toolset, "v100") ||
|
||||
cmHasLiteralPrefix(toolset, "v110") ||
|
||||
cmHasLiteralPrefix(toolset, "v120"))) {
|
||||
if (const char* debug =
|
||||
|
@ -110,10 +110,6 @@ set_target_properties(
|
||||
AUTOMOC TRUE
|
||||
)
|
||||
|
||||
# Test AUTOMOC and AUTORCC on source files with the same name
|
||||
# but in different subdirectories
|
||||
add_subdirectory(same_name)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
# The order is relevant here. B depends on A, and B headers depend on A
|
||||
# headers both subdirectories use CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE and we
|
||||
|
@ -1,20 +0,0 @@
|
||||
# Test AUTOMOC and AUTORCC on source files with the same name
|
||||
# but in different subdirectories
|
||||
|
||||
add_executable(same_name
|
||||
aaa/bbb/item.cpp
|
||||
aaa/bbb/data.qrc
|
||||
aaa/item.cpp
|
||||
aaa/data.qrc
|
||||
bbb/aaa/item.cpp
|
||||
bbb/aaa/data.qrc
|
||||
bbb/item.cpp
|
||||
bbb/data.qrc
|
||||
ccc/item.cpp
|
||||
ccc/data.qrc
|
||||
main.cpp
|
||||
data.qrc
|
||||
)
|
||||
target_include_directories(same_name PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||
target_link_libraries(same_name ${QT_LIBRARIES})
|
||||
set_target_properties( same_name PROPERTIES AUTOMOC TRUE AUTORCC TRUE )
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="aaa/bbb">
|
||||
<file>item.hpp</file>
|
||||
<file>item.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,10 +0,0 @@
|
||||
#include "item.hpp"
|
||||
|
||||
namespace aaa {
|
||||
namespace bbb {
|
||||
|
||||
void Item::go()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef SDA_SDB_ITEM_HPP
|
||||
#define SDA_SDB_ITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace aaa {
|
||||
namespace bbb {
|
||||
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="aaa/">
|
||||
<file>item.hpp</file>
|
||||
<file>item.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,8 +0,0 @@
|
||||
#include "item.hpp"
|
||||
|
||||
namespace aaa {
|
||||
|
||||
void Item::go()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#ifndef SDA_ITEM_HPP
|
||||
#define SDA_ITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace aaa {
|
||||
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="bbb/aaa/">
|
||||
<file>item.hpp</file>
|
||||
<file>item.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,10 +0,0 @@
|
||||
#include "item.hpp"
|
||||
|
||||
namespace bbb {
|
||||
namespace aaa {
|
||||
|
||||
void Item::go()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
#ifndef SDB_SDA_ITEM_HPP
|
||||
#define SDB_SDA_ITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace bbb {
|
||||
namespace aaa {
|
||||
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="bbb/">
|
||||
<file>item.hpp</file>
|
||||
<file>item.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,8 +0,0 @@
|
||||
#include "item.hpp"
|
||||
|
||||
namespace bbb {
|
||||
|
||||
void Item::go()
|
||||
{
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
#ifndef SDB_ITEM_HPP
|
||||
#define SDB_ITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace bbb {
|
||||
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="ccc/">
|
||||
<file>item.hpp</file>
|
||||
<file>item.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,23 +0,0 @@
|
||||
#include "item.hpp"
|
||||
|
||||
namespace ccc {
|
||||
|
||||
void Item::go()
|
||||
{
|
||||
}
|
||||
|
||||
class MocTest : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
|
||||
void MocTest::go()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Include own moc files
|
||||
#include "item.moc"
|
||||
#include "moc_item.cpp"
|
@ -1,16 +0,0 @@
|
||||
#ifndef SDC_ITEM_HPP
|
||||
#define SDC_ITEM_HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
namespace ccc {
|
||||
|
||||
class Item : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>main.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,16 +0,0 @@
|
||||
#include "aaa/bbb/item.hpp"
|
||||
#include "aaa/item.hpp"
|
||||
#include "bbb/aaa/item.hpp"
|
||||
#include "bbb/item.hpp"
|
||||
#include "ccc/item.hpp"
|
||||
|
||||
int main(int argv, char** args)
|
||||
{
|
||||
// Object instances
|
||||
::aaa::Item aaa_item;
|
||||
::aaa::bbb::Item aaa_bbb_item;
|
||||
::bbb::Item bbb_item;
|
||||
::bbb::aaa::Item bbb_aaa_item;
|
||||
::ccc::Item ccc_item;
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user