diff --git a/cmake/Platform.cmake b/cmake/Platform.cmake index 590aeece..9117a9e0 100644 --- a/cmake/Platform.cmake +++ b/cmake/Platform.cmake @@ -1,22 +1,4 @@ -if (NOT DEFINED GEODE_TARGET_PLATFORM) - if(APPLE) - if(IOS) - set(GEODE_TARGET_PLATFORM "iOS") - else() - set(GEODE_TARGET_PLATFORM "MacOS") - endif() - elseif(WIN32) - set(GEODE_TARGET_PLATFORM "Win32") - elseif(ANDROID) - if (ANDROID_ABI STREQUAL "arm64-v8a") - set(GEODE_TARGET_PLATFORM "Android64") - elseif(ANDROID_ABI STREQUAL "armeabi-v7a") - set(GEODE_TARGET_PLATFORM "Android32") - endif() - else() - message(FATAL_ERROR "Unable to detect platform, please set GEODE_TARGET_PLATFORM in the root CMake file.") - endif() -endif() +include(PlatformDetect.cmake) if (NOT ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME}) set(GEODE_TARGET_PLATFORM GEODE_TARGET_PLATFORM PARENT_SCOPE) diff --git a/cmake/PlatformDetect.cmake b/cmake/PlatformDetect.cmake new file mode 100644 index 00000000..f652810b --- /dev/null +++ b/cmake/PlatformDetect.cmake @@ -0,0 +1,19 @@ +if (NOT DEFINED GEODE_TARGET_PLATFORM) + if(APPLE) + if(IOS) + set(GEODE_TARGET_PLATFORM "iOS") + else() + set(GEODE_TARGET_PLATFORM "MacOS") + endif() + elseif(WIN32) + set(GEODE_TARGET_PLATFORM "Win32") + elseif(ANDROID) + if (ANDROID_ABI STREQUAL "arm64-v8a") + set(GEODE_TARGET_PLATFORM "Android64") + elseif(ANDROID_ABI STREQUAL "armeabi-v7a") + set(GEODE_TARGET_PLATFORM "Android32") + endif() + else() + message(FATAL_ERROR "Unable to detect platform, please set GEODE_TARGET_PLATFORM in the root CMake file.") + endif() +endif() \ No newline at end of file