Skip to content

Commit f413686

Browse files
committed
[INFRA] Simplify platform.hpp combile check
1 parent c27b374 commit f413686

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

cmake/seqan3-config.cmake

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,17 @@ endif ()
253253
# Perform compilability test of platform.hpp (tests some requirements)
254254
# ----------------------------------------------------------------------------
255255

256-
set (CXXSTD_TEST_SOURCE "#include <seqan3/core/platform.hpp>
257-
int main() {}")
258-
259-
# using try_compile instead of check_cxx_source_compiles to capture output in case of failure
260-
file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx" "${CXXSTD_TEST_SOURCE}\n")
261-
262-
# cereal::cereal is an interface target and cannot be used in try_compile:
263-
# There is no shared or static library to link against.
264-
set (SEQAN3_TRYCOMPILE_LIBRARIES ${SEQAN3_LIBRARIES})
265-
list (REMOVE_ITEM SEQAN3_TRYCOMPILE_LIBRARIES cereal::cereal)
266256
# cmake-format: off
257+
# Note: With CMake >= 3.25, the file WRITE can be removed, the second and third line in try_compile can be replaced by
258+
# SOURCE_FROM_CONTENT "platform_test.cpp" "#include <seqan3/core/platform.hpp>\nint main() {}"
259+
file (WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/platform_test.cpp"
260+
"#include <seqan3/core/platform.hpp>\nint main() {}")
261+
267262
try_compile (SEQAN3_PLATFORM_TEST
268263
${CMAKE_BINARY_DIR}
269-
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
270-
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_INCLUDE_PATH};${SEQAN3_INCLUDE_DIR}"
264+
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/platform_test.cpp
265+
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${SEQAN3_INCLUDE_DIR}"
271266
COMPILE_DEFINITIONS ${SEQAN3_DEFINITIONS}
272-
LINK_LIBRARIES ${SEQAN3_TRYCOMPILE_LIBRARIES}
273267
CXX_STANDARD 23
274268
CXX_STANDARD_REQUIRED ON
275269
CXX_EXTENSIONS OFF

0 commit comments

Comments
 (0)