From 5d9f739ebd13834152a9305eb089c7377c5b5b3b Mon Sep 17 00:00:00 2001 From: Adharsh Babu Date: Thu, 5 Sep 2024 21:14:32 -0700 Subject: [PATCH] CMake patches for QNX Support (#178) Patches to support building Starling on QNX --------- Co-authored-by: Christian Reimer --- .cmake-format.yaml | 2 +- CompileOptions.cmake | 4 ++++ TestTargets.cmake | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 8d4baa2..9e365b7 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -54,7 +54,7 @@ lint: max_branches: 40 # Default target: 12 max_arguments: 6 # Default target: 5 max_localvars: 15 - max_statements: 125 # Default target: 50 + max_statements: 130 # Default target: 50 encode: emit_byteorder_mark: false input_encoding: utf-8 diff --git a/CompileOptions.cmake b/CompileOptions.cmake index 3de0191..9f059c6 100644 --- a/CompileOptions.cmake +++ b/CompileOptions.cmake @@ -135,6 +135,10 @@ function(swift_set_compile_options) endif() endif() + if(CMAKE_SYSTEM_NAME MATCHES "QNX") + list(APPEND all_flags -D_QNX_SOURCE) + endif () + list(APPEND all_flags -Wall -Wcast-align diff --git a/TestTargets.cmake b/TestTargets.cmake index 26558b1..59509ab 100644 --- a/TestTargets.cmake +++ b/TestTargets.cmake @@ -299,6 +299,9 @@ function(swift_add_test target) endif() if(x_LINK) target_link_libraries(${target} PRIVATE ${x_LINK}) + if(CMAKE_SYSTEM_NAME MATCHES "QNX") + target_link_libraries(${target} PRIVATE regex) + endif () endif() if (NOT ${PROJECT_NAME}_BUILD_TESTS)