try 3
This commit is contained in:
@@ -109,6 +109,7 @@ if(NOT TINYTEST_USE_SYSTEM_CPPUTILS)
|
|||||||
# Disable CPPUtils tests to avoid conflicts with our targets
|
# Disable CPPUtils tests to avoid conflicts with our targets
|
||||||
set(CPPUTILS_BUILD_TESTS OFF CACHE BOOL "Disable CPPUtils tests" FORCE)
|
set(CPPUTILS_BUILD_TESTS OFF CACHE BOOL "Disable CPPUtils tests" FORCE)
|
||||||
set(CPPUTILS_ENABLE_TESTING OFF CACHE BOOL "Disable CPPUtils testing framework" FORCE)
|
set(CPPUTILS_ENABLE_TESTING OFF CACHE BOOL "Disable CPPUtils testing framework" FORCE)
|
||||||
|
set(CPPUTILS_SKIP_GOOGLETEST ON CACHE BOOL "Disable Google Test fetching in CPPUtils" FORCE)
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
cpputils
|
cpputils
|
||||||
@@ -121,10 +122,20 @@ if(NOT TINYTEST_USE_SYSTEM_CPPUTILS)
|
|||||||
if(NOT cpputils_POPULATED)
|
if(NOT cpputils_POPULATED)
|
||||||
FetchContent_Populate(cpputils)
|
FetchContent_Populate(cpputils)
|
||||||
|
|
||||||
|
# Try to patch the CPPUtils CMakeLists.txt to prevent Google Test fetching
|
||||||
|
if(EXISTS "${cpputils_SOURCE_DIR}/CMakeLists.txt")
|
||||||
|
file(READ "${cpputils_SOURCE_DIR}/CMakeLists.txt" CPPUTILS_CMAKE_CONTENT)
|
||||||
|
string(REPLACE "FetchContent_MakeAvailable(googletest)" "" CPPUTILS_CMAKE_CONTENT "${CPPUTILS_CMAKE_CONTENT}")
|
||||||
|
string(REPLACE "find_package(GTest REQUIRED)" "" CPPUTILS_CMAKE_CONTENT "${CPPUTILS_CMAKE_CONTENT}")
|
||||||
|
string(REPLACE "FetchContent_Declare(googletest" "# Disabled FetchContent_Declare(googletest" CPPUTILS_CMAKE_CONTENT "${CPPUTILS_CMAKE_CONTENT}")
|
||||||
|
file(WRITE "${cpputils_SOURCE_DIR}/CMakeLists.txt" "${CPPUTILS_CMAKE_CONTENT}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Set variables to prevent conflicts before we include the CMakeLists.txt
|
# Set variables to prevent conflicts before we include the CMakeLists.txt
|
||||||
set(CPPUTILS_BUILD_TESTS OFF CACHE BOOL "Disable CPPUtils tests" FORCE)
|
set(CPPUTILS_BUILD_TESTS OFF CACHE BOOL "Disable CPPUtils tests" FORCE)
|
||||||
set(CPPUTILS_BUILD_EXAMPLES OFF CACHE BOOL "Disable CPPUtils examples" FORCE)
|
set(CPPUTILS_BUILD_EXAMPLES OFF CACHE BOOL "Disable CPPUtils examples" FORCE)
|
||||||
set(CPPUTILS_ENABLE_TESTING OFF CACHE BOOL "Disable CPPUtils testing framework" FORCE)
|
set(CPPUTILS_ENABLE_TESTING OFF CACHE BOOL "Disable CPPUtils testing framework" FORCE)
|
||||||
|
set(CPPUTILS_SKIP_GOOGLETEST ON CACHE BOOL "Disable Google Test fetching in CPPUtils" FORCE)
|
||||||
|
|
||||||
# Store original flags
|
# Store original flags
|
||||||
set(CMAKE_CXX_FLAGS_ORIG ${CMAKE_CXX_FLAGS})
|
set(CMAKE_CXX_FLAGS_ORIG ${CMAKE_CXX_FLAGS})
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
@echo off
|
@echo off
|
||||||
:: Helper script to build TinyTest with CMake on Windows
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
:: Create build directory if it doesn't exist
|
REM Create build directory if it doesn't exist
|
||||||
if not exist build mkdir build
|
if not exist build_ci mkdir build_ci
|
||||||
cd build
|
cd build_ci
|
||||||
|
|
||||||
:: Configure with CMake
|
REM Use the same CMake settings as in CI
|
||||||
echo Configuring with CMake...
|
cmake .. ^
|
||||||
cmake .. %*
|
-DCMAKE_BUILD_TYPE=Debug ^
|
||||||
|
-DTINYTEST_BUILD_SHARED_LIBS=OFF ^
|
||||||
|
-DBUILD_TESTING=ON
|
||||||
|
|
||||||
:: Build
|
REM Build the project
|
||||||
echo Building...
|
cmake --build . --config Debug
|
||||||
cmake --build . --config Release
|
|
||||||
|
|
||||||
echo Build complete!
|
REM Run tests
|
||||||
echo To run tests: cd build ^&^& ctest -C Release
|
ctest -C Debug --output-on-failure
|
||||||
echo To install: cd build ^&^& cmake --install . --config Release
|
|
||||||
|
echo "Build complete!"
|
||||||
|
echo "To run tests: cd build_ci && ctest -C Debug"
|
||||||
|
echo "To install: cd build_ci && cmake --install . --config Debug"
|
||||||
@@ -5,17 +5,21 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Create build directory if it doesn't exist
|
# Create build directory if it doesn't exist
|
||||||
mkdir -p build
|
mkdir -p build_ci
|
||||||
cd build
|
cd build_ci
|
||||||
|
|
||||||
# Configure with CMake
|
# Use the same CMake settings as in CI
|
||||||
echo "Configuring with CMake..."
|
cmake .. \
|
||||||
cmake .. $@
|
-DCMAKE_BUILD_TYPE=Debug \
|
||||||
|
-DTINYTEST_BUILD_SHARED_LIBS=OFF \
|
||||||
|
-DBUILD_TESTING=ON
|
||||||
|
|
||||||
# Build
|
# Build the project
|
||||||
echo "Building..."
|
|
||||||
cmake --build .
|
cmake --build .
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
ctest --output-on-failure
|
||||||
|
|
||||||
echo "Build complete!"
|
echo "Build complete!"
|
||||||
echo "To run tests: cd build && ctest"
|
echo "To run tests: cd build_ci && ctest"
|
||||||
echo "To install: cd build && sudo cmake --install ."
|
echo "To install: cd build_ci && sudo cmake --install ."
|
||||||
Reference in New Issue
Block a user