Merge branch 'cpack-osx-optional-CoreServices' into release
This commit is contained in:
commit
d9857c8457
|
@ -728,7 +728,20 @@ endif()
|
||||||
add_library(CPackLib ${CPACK_SRCS})
|
add_library(CPackLib ${CPACK_SRCS})
|
||||||
target_link_libraries(CPackLib CMakeLib)
|
target_link_libraries(CPackLib CMakeLib)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
# Some compilers produce errors in the CoreServices framework headers.
|
||||||
|
# Ideally such errors should be fixed by either the compiler vendor
|
||||||
|
# or the framework source, but we try to workaround it and build anyway.
|
||||||
|
# If it does not work, build with reduced functionality and warn.
|
||||||
|
check_include_file("CoreServices/CoreServices.h" HAVE_CoreServices)
|
||||||
|
if(HAVE_CoreServices)
|
||||||
|
set_property(SOURCE CPack/cmCPackDragNDropGenerator.cxx PROPERTY COMPILE_DEFINITIONS HAVE_CoreServices)
|
||||||
target_link_libraries(CPackLib "-framework CoreServices")
|
target_link_libraries(CPackLib "-framework CoreServices")
|
||||||
|
else()
|
||||||
|
message(WARNING "This compiler does not appear to support\n"
|
||||||
|
" #include <CoreServices/CoreServices.h>\n"
|
||||||
|
"Some CPack functionality may be limited.\n"
|
||||||
|
"See CMakeFiles/CMakeError.log for details of the failure.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
|
|
@ -22,10 +22,12 @@
|
||||||
|
|
||||||
#include <CoreFoundation/CoreFoundation.h>
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CoreServices
|
||||||
// For the old LocaleStringToLangAndRegionCodes() function, to convert
|
// For the old LocaleStringToLangAndRegionCodes() function, to convert
|
||||||
// to the old Script Manager RegionCode values needed for the 'LPic' data
|
// to the old Script Manager RegionCode values needed for the 'LPic' data
|
||||||
// structure used for generating multi-lingual SLAs.
|
// structure used for generating multi-lingual SLAs.
|
||||||
#include <CoreServices/CoreServices.h>
|
#include <CoreServices/CoreServices.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char* SLAHeader =
|
static const char* SLAHeader =
|
||||||
"data 'LPic' (5000) {\n"
|
"data 'LPic' (5000) {\n"
|
||||||
|
@ -643,9 +645,11 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
|
||||||
kCFStringEncodingMacRoman);
|
kCFStringEncodingMacRoman);
|
||||||
LangCode lang = 0;
|
LangCode lang = 0;
|
||||||
RegionCode region = 0;
|
RegionCode region = 0;
|
||||||
|
#ifdef HAVE_CoreServices
|
||||||
OSStatus err = LocaleStringToLangAndRegionCodes(iso_language_cstr,
|
OSStatus err = LocaleStringToLangAndRegionCodes(iso_language_cstr,
|
||||||
&lang, ®ion);
|
&lang, ®ion);
|
||||||
if (err != noErr)
|
if (err != noErr)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
cmCPackLogger(cmCPackLog::LOG_ERROR,
|
||||||
"No language/region code available for " << iso_language_cstr
|
"No language/region code available for " << iso_language_cstr
|
||||||
|
@ -653,10 +657,12 @@ int cmCPackDragNDropGenerator::CreateDMG(const std::string& src_dir,
|
||||||
free(iso_language_cstr);
|
free(iso_language_cstr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_CoreServices
|
||||||
free(iso_language_cstr);
|
free(iso_language_cstr);
|
||||||
header_data.push_back(region);
|
header_data.push_back(region);
|
||||||
header_data.push_back(i);
|
header_data.push_back(i);
|
||||||
header_data.push_back(0);
|
header_data.push_back(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
ofs << "data 'LPic' (5000) {\n";
|
ofs << "data 'LPic' (5000) {\n";
|
||||||
ofs << std::hex << std::uppercase << std::setfill('0');
|
ofs << std::hex << std::uppercase << std::setfill('0');
|
||||||
|
|
Loading…
Reference in New Issue