summaryrefslogtreecommitdiff
path: root/Toolchain/CMake/CMakeToolchain.txt
diff options
context:
space:
mode:
authorGunnar Beutner <gunnar@beutner.name>2021-04-15 13:32:29 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-16 19:04:24 +0200
commit594d480391ac7371aaf7837755986fefbed27bec (patch)
tree864331c63736857210b0278838c3eb660c12c6b1 /Toolchain/CMake/CMakeToolchain.txt
parentc6c1e2037b819ffec0a91a6a2ec3f9c7e1a5a0e3 (diff)
downloadserenity-594d480391ac7371aaf7837755986fefbed27bec.zip
Toolchain+Ports: Move the CMake toolchain file into a subdirectory
Diffstat (limited to 'Toolchain/CMake/CMakeToolchain.txt')
-rw-r--r--Toolchain/CMake/CMakeToolchain.txt33
1 files changed, 33 insertions, 0 deletions
diff --git a/Toolchain/CMake/CMakeToolchain.txt b/Toolchain/CMake/CMakeToolchain.txt
new file mode 100644
index 0000000000..43d0538a9c
--- /dev/null
+++ b/Toolchain/CMake/CMakeToolchain.txt
@@ -0,0 +1,33 @@
+set(CMAKE_SYSTEM_NAME SerenityOS)
+
+if (NOT DEFINED ENV{SERENITY_ARCH})
+ message(FATAL_ERROR "SERENITY_ARCH not set.")
+endif()
+
+if (NOT DEFINED ENV{SERENITY_ROOT})
+ message(FATAL_ERROR "SERENITY_ROOT not set.")
+endif()
+
+set(SERENITYOS 1)
+
+set(CMAKE_SYSTEM_PROCESSOR "$ENV{SERENITY_ARCH}")
+
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
+
+set(SERENITY_BUILD_DIR $ENV{SERENITY_ROOT}/Build/$ENV{SERENITY_ARCH})
+
+# where to read from/write to
+set(CMAKE_SYSROOT ${SERENITY_BUILD_DIR}/Root)
+set(CMAKE_STAGING_PREFIX ${SERENITY_BUILD_DIR}/Root/usr)
+set(CMAKE_INSTALL_PREFIX ${SERENITY_BUILD_DIR}/Root/usr)
+set(CMAKE_INSTALL_DATAROOTDIR ${SERENITY_BUILD_DIR}/Root/usr/share)
+
+set(CMAKE_C_COMPILER $ENV{SERENITY_ARCH}-pc-serenity-gcc)
+set(CMAKE_CXX_COMPILER $ENV{SERENITY_ARCH}-pc-serenity-g++)
+
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+list(APPEND CMAKE_MODULE_PATH "$ENV{SERENITY_ROOT}/Toolchain/CMake")