diff options
author | Brad King <brad.king@kitware.com> | 2016-03-18 12:49:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-03-18 15:12:51 (GMT) |
commit | d84ba668d7dd77ac38b3795f92e4ef0f894c696e (patch) | |
tree | 8bfdf3818f4db4107fc070943a478a6f59409e86 /Source/CMakeLists.txt | |
parent | c718070c0887e1c429d6ae4b717c006236c32736 (diff) | |
download | CMake-d84ba668d7dd77ac38b3795f92e4ef0f894c696e.zip CMake-d84ba668d7dd77ac38b3795f92e4ef0f894c696e.tar.gz CMake-d84ba668d7dd77ac38b3795f92e4ef0f894c696e.tar.bz2 |
CPack: Avoid using OS X CoreServices if compiler fails on header (#16021)
Some compilers on OS X report errors in the CoreServices framework headers.
Check for support of the header ahead of time and compile the relevant code
only when the header is available.
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r-- | Source/CMakeLists.txt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 5b67a2d..4ef0e80 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -728,7 +728,20 @@ endif() add_library(CPackLib ${CPACK_SRCS}) target_link_libraries(CPackLib CMakeLib) if(APPLE) - target_link_libraries(CPackLib "-framework CoreServices") + # 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") + 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() if(APPLE) |