From a41e875dfef76361c3168d8fbf409ba2db2f1734 Mon Sep 17 00:00:00 2001 From: CI <-ci@not-real.com> Date: Fri, 10 Nov 2023 21:19:54 +0100 Subject: [PATCH] ci debug19 --- CMakeLists.txt | 14 +++++++++----- test/CMakeLists.txt | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 887a98b..18a07c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,13 @@ endif() include (CTest) +# Set the library file extension based on the operating system +if (WIN32) + set(LIB_EXT ".dll.a") +else() + set(LIB_EXT ".a") +endif() + if ("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}" AND BUILD_TESTING) find_package(Criterion QUIET) if (NOT CRITERION_FOUND) @@ -140,11 +147,8 @@ if ("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}" AND BUILD_TESTING) # Set include directories and library paths set(CRITERION_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/Criterion/include") - if (WIN32) - set(CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/src/libcriterion.dll.a") # For Windows - else() - set(CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/src/libcriterion.a") # For Linux and other Unix-like systems - endif() + set(CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/src/libcriterion${CRITERION_LIB_EXT}") # For Windows + # Check if criterion.h exists in the provided include directory diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1c37b39..6359203 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,33 +1,33 @@ set (TEST_SOURCES tests.c) # Append additional libraries to CRITERION_LIBRARIES if they exist -if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanomsg/libnanomsg.a") - list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanomsg/libnanomsg.a") +if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanomsg/libnanomsg${LIB_EXT}") + list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanomsg/libnanomsg${LIB_EXT}") endif() -if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanopb/libprotobuf_nanopb_static.a") - list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanopb/libprotobuf_nanopb_static.a") +if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanopb/libprotobuf_nanopb_static${LIB_EXT}") + list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/nanopb/libprotobuf_nanopb_static${LIB_EXT}") endif() -if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/boxfort/src/libboxfort.a") - list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/boxfort/src/libboxfort.a") +if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/boxfort/src/libboxfort${LIB_EXT}") + list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/boxfort/src/libboxfort${LIB_EXT}") endif() -if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/libgit2/src/libgit2.a") - list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/libgit2/src/libgit2.a") +if(EXISTS "${CMAKE_BINARY_DIR}/Criterion/subprojects/libgit2/libgit2${LIB_EXT}") + list(APPEND CRITERION_LIBRARIES "${CMAKE_BINARY_DIR}/Criterion/subprojects/libgit2/libgit2${LIB_EXT}") else() - # Execute the find program to locate libgit2.a + # Execute the find program to locate libgit2${LIB_EXT} execute_process( - COMMAND find "${CMAKE_BINARY_DIR}/Criterion" -name libgit2.a + COMMAND find "${CMAKE_BINARY_DIR}/Criterion" -name libgit2${LIB_EXT} OUTPUT_VARIABLE FOUND_LIBGIT2 OUTPUT_STRIP_TRAILING_WHITESPACE ) # If found, append to CRITERION_LIBRARIES if(FOUND_LIBGIT2) - message(STATUS "Found libgit2.a at: ${FOUND_LIBGIT2}") + message(STATUS "Found libgit2${LIB_EXT} at: ${FOUND_LIBGIT2}") list(APPEND CRITERION_LIBRARIES "${FOUND_LIBGIT2}") else() - message(WARNING "libgit2.a not found in Criterion subprojects.") + message(WARNING "libgit2${LIB_EXT} not found in Criterion subprojects.") endif() endif()