Skip to content

Commit

Permalink
ci debug19
Browse files Browse the repository at this point in the history
  • Loading branch information
CI committed Nov 10, 2023
1 parent 1ba7c36 commit a41e875
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
14 changes: 9 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
24 changes: 12 additions & 12 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand Down

0 comments on commit a41e875

Please sign in to comment.