diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/try-compile | |
Diffstat (limited to 'vcpkg/scripts/test_ports/try-compile')
5 files changed, 41 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt b/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt new file mode 100644 index 0000000..1d1d93a --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25)
+
+project(try-compile-test LANGUAGES C CXX)
+
+try_compile(result PROJECT test-try-compile SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/try")
+
+if(NOT result)
+ message(FATAL_ERROR "Compiler flags are not passed consistently to try_compile!")
+endif()
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/portfile.cmake b/vcpkg/scripts/test_ports/try-compile/portfile.cmake new file mode 100644 index 0000000..b7c364e --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/portfile.cmake @@ -0,0 +1,9 @@ +
+string(APPEND VCPKG_C_FLAGS " -DVCPKG_LET_ME_PASS")
+string(APPEND VCPKG_CXX_FLAGS " -DVCPKG_LET_ME_PASS")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}"
+)
+
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt b/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt new file mode 100644 index 0000000..d5f1696 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25)
+
+project(try-compile-project LANGUAGES C CXX)
+
+add_library(result "${CMAKE_CURRENT_SOURCE_DIR}/try-compile.c")
+
diff --git a/vcpkg/scripts/test_ports/try-compile/try/try-compile.c b/vcpkg/scripts/test_ports/try-compile/try/try-compile.c new file mode 100644 index 0000000..d3d6712 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/try/try-compile.c @@ -0,0 +1,5 @@ +
+
+#if !defined(VCPKG_LET_ME_PASS)
+ #error "You shall not pass without forwarding compiler flags to try_compile!"
+#endif
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/vcpkg.json b/vcpkg/scripts/test_ports/try-compile/vcpkg.json new file mode 100644 index 0000000..8ccd705 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "try-compile", + "version": "1", + "description": "Test if try compile correctly passes on compiler flags", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |