Statically link against atomic.a on Linux-ARM32 platforms (dotnet/core-setup#5322)
authorAaron Robinson <arobins@microsoft.com>
Mon, 4 Mar 2019 21:01:46 +0000 (13:01 -0800)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2019 21:01:46 +0000 (13:01 -0800)
Commit migrated from https://github.com/dotnet/core-setup/commit/5e82a65b7267950f2613b79de8068a6751f63eaa

src/installer/corehost/cli/common.cmake
src/installer/corehost/cli/exe.cmake
src/installer/corehost/cli/lib.cmake

index b0fd5e0..f5f81d7 100644 (file)
@@ -38,3 +38,25 @@ if(WIN32 AND NOT SKIP_VERSIONING)
     list(APPEND RESOURCES ${CMAKE_CURRENT_LIST_DIR}/native.rc)
 endif()
 
+function(set_common_libs TargetType)
+
+    # Libraries used for exe projects
+    if (${TargetType} STREQUAL "exe")
+        if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
+            target_link_libraries (${DOTNET_PROJECT_NAME} "pthread")
+        endif()
+
+        if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+            target_link_libraries (${DOTNET_PROJECT_NAME} "dl")
+        endif()
+    endif()
+
+    # Specify the import library to link against for Arm32 build since the default set is minimal
+    if (CLI_CMAKE_PLATFORM_ARCH_ARM)
+        if (WIN32)
+            target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib)
+        else()
+            target_link_libraries(${DOTNET_PROJECT_NAME} atomic.a)
+        endif()
+    endif()
+endfunction()
index 3869ae8..b71b8ad 100644 (file)
@@ -22,15 +22,4 @@ endif()
 
 install(TARGETS ${DOTNET_PROJECT_NAME} DESTINATION bin)
 
-if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
-    target_link_libraries (${DOTNET_PROJECT_NAME} "pthread")
-endif()
-
-if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-    target_link_libraries (${DOTNET_PROJECT_NAME} "dl")
-endif()
-
-# Specify the import library to link against for Arm32 build since the default set is minimal
-if (WIN32 AND CLI_CMAKE_PLATFORM_ARCH_ARM)
-    target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib)
-endif()
+set_common_libs("exe")
index 4ba895e..aa53e4c 100644 (file)
@@ -13,7 +13,4 @@ add_library(${DOTNET_PROJECT_NAME} SHARED ${SOURCES} ${RESOURCES})
 
 set_target_properties(${DOTNET_PROJECT_NAME} PROPERTIES MACOSX_RPATH TRUE)
 
-# Specify the import library to link against for Arm32 build since the default set is minimal
-if (WIN32 AND CLI_CMAKE_PLATFORM_ARCH_ARM)
-    target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib)
-endif()
\ No newline at end of file
+set_common_libs("lib")