summaryrefslogtreecommitdiffstats
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-01-16 16:00:59 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2017-01-16 16:00:59 (GMT)
commit2ad405202e811affb9961f96a90d319d49a88b11 (patch)
tree25180c53e5180fd42431b483f187a80ea5302d57 /Source/CMakeLists.txt
parent7bd1d53505045bfa97f573f7b587514012618913 (diff)
parentcda9a904b5ef76d923a072a45c0c15fd1d87d6be (diff)
downloadCMake-2ad405202e811affb9961f96a90d319d49a88b11.zip
CMake-2ad405202e811affb9961f96a90d319d49a88b11.tar.gz
CMake-2ad405202e811affb9961f96a90d319d49a88b11.tar.bz2
Merge topic 'sparc-libatomic'
cda9a904 Explicitly link against libatomic on Linux/sparc for `__atomic_fetch_add_4`
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 57b7b25..2835ee6 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -787,6 +787,15 @@ target_link_libraries(CMakeLib cmsys
${CMake_KWIML_LIBRARIES}
)
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
+ # the atomic instructions are implemented using libatomic on some platforms,
+ # so linking to that may be required
+ check_library_exists(atomic __atomic_fetch_add_4 "" LIBATOMIC_NEEDED)
+ if(LIBATOMIC_NEEDED)
+ target_link_libraries(CMakeLib atomic)
+ endif()
+endif()
+
# On Apple we need CoreFoundation
if(APPLE)
target_link_libraries(CMakeLib "-framework CoreFoundation")