aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeModules/DetectArchitecture.cmake
diff options
context:
space:
mode:
authorLioncash <[email protected]>2016-08-22 09:12:46 -0400
committerMerryMage <[email protected]>2016-08-22 15:55:39 +0100
commit1bedd3bd7f97ddd4904ab5280fcd947248b63ba9 (patch)
tree36c766d0377ba0c1d8eaecb7df5994ae6e2ed312 /CMakeModules/DetectArchitecture.cmake
parent74246cc3bfcbe282890f13770f3778e5680244cb (diff)
downloaddynarmic-1bedd3bd7f97ddd4904ab5280fcd947248b63ba9.tar.gz
dynarmic-1bedd3bd7f97ddd4904ab5280fcd947248b63ba9.zip
CMakeLists: Clean up
Moves functions out of the main CMakeLists file into module files that can just be included whenever necessary. This also uses the CMake provided variables for enforcing compiler requirements.
Diffstat (limited to 'CMakeModules/DetectArchitecture.cmake')
-rw-r--r--CMakeModules/DetectArchitecture.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/CMakeModules/DetectArchitecture.cmake b/CMakeModules/DetectArchitecture.cmake
new file mode 100644
index 00000000..e984c6b8
--- /dev/null
+++ b/CMakeModules/DetectArchitecture.cmake
@@ -0,0 +1,16 @@
+include(CheckSymbolExists)
+function(detect_architecture symbol arch)
+ if (NOT DEFINED ARCHITECTURE)
+ set(CMAKE_REQUIRED_QUIET 1)
+ check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
+ unset(CMAKE_REQUIRED_QUIET)
+
+ # The output variable needs to be unique across invocations otherwise
+ # CMake's crazy scope rules will keep it defined
+ if (ARCHITECTURE_${arch})
+ set(ARCHITECTURE "${arch}" PARENT_SCOPE)
+ set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
+ add_definitions(-DARCHITECTURE_${arch}=1)
+ endif()
+ endif()
+endfunction()