Simplify emitter's RegEncoding
[platform/upstream/coreclr.git] / functions.cmake
index f8a2eea..cbcc70f 100644 (file)
@@ -1,6 +1,8 @@
 function(clr_unknown_arch)
     if (WIN32)
         message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported")
+    elseif(CLR_CROSS_COMPONENTS_BUILD)
+        message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component")
     else()
         message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
     endif()
@@ -119,7 +121,7 @@ endfunction()
 
 function(strip_symbols targetName outputFilename)
   if (CLR_CMAKE_PLATFORM_UNIX)
-    if (UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
+    if (STRIP_SYMBOLS)
 
       # On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
       # generator expression doesn't work correctly returning the wrong path and on
@@ -156,7 +158,7 @@ function(strip_symbols targetName outputFilename)
       endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
 
       set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
-    endif(UPPERCASE_CMAKE_BUILD_TYPE STREQUAL RELEASE)
+    endif (STRIP_SYMBOLS)
   endif(CLR_CMAKE_PLATFORM_UNIX)
 endfunction()
 
@@ -216,3 +218,19 @@ function(_install)
       install(${ARGV})
     endif()
 endfunction()
+
+function(verify_dependencies targetName errorMessage)
+    # We don't need to verify dependencies on OSX, since missing dependencies
+    # result in link error over there.
+    if (NOT CLR_CMAKE_PLATFORM_DARWIN AND NOT CLR_CMAKE_PLATFORM_ANDROID)
+        add_custom_command(
+            TARGET ${targetName}
+            POST_BUILD
+            VERBATIM
+            COMMAND ${CMAKE_SOURCE_DIR}/verify-so.sh 
+                $<TARGET_FILE:${targetName}> 
+                ${errorMessage}
+            COMMENT "Verifying ${targetName} dependencies"
+        )
+    endif()
+endfunction()