diff options
author | Brad King <brad.king@kitware.com> | 2016-03-21 09:39:24 -0400 |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-03-21 09:39:24 -0400 |
commit | cd992170db7a85f00d4ad38f78f0b38c33f83d1f (patch) | |
tree | ab14ac8e8e9a3cd06669358b9f5829ba7d42ae49 /Source/CMakeLists.txt | |
parent | 8da0997872d454062bc50b3d4ff5d2777583202f (diff) | |
parent | d84ba668d7dd77ac38b3795f92e4ef0f894c696e (diff) | |
download | cmake-cd992170db7a85f00d4ad38f78f0b38c33f83d1f.tar.gz |
Merge topic 'cpack-osx-optional-CoreServices'
d84ba668 CPack: Avoid using OS X CoreServices if compiler fails on header (#16021)
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 8dd58af223..467b6926db 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -724,7 +724,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) |