Files
solver/tests/CMakeLists.txt
aiksiongkoh 3d6a23a678 Cmake gtest (#72)
* Check rackpin and gear for zero radii

* rebase zero-radii-check (#69)

* contributing

* Update push-freecad.yml

updated actions/checkout to v4

* dragging log for debugging

* fix calcdxNorm crash

* setDebug and remove MBDyn*

* Update cmakelists.txt

* fix includes for gcc-14

gcc-14 is more disciplined about not including <algorithm> transitively.

* fix runDragStep

* backhoe files (#65)

* Mark unused variables to silence compiler warnings. (#64)

* Backhoe issues (#67)

* backhoe issues

* runDragStep edit

* backhoe issues

* runDragStep edit

* Reduce large drag step progressively until convergence.

* Switch to using built-in M_PI, even on MSVC (#68)

---------

Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain>
Co-authored-by: mosfet80 <realeandrea@yahoo.it>
Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
Co-authored-by: Jed Brown <jed@jedbrown.org>
Co-authored-by: sliptonic <shopinthewoods@gmail.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>

* in progress

* Gtest added

---------

Co-authored-by: Brad Collette <bradcollette@pop-os.localdomain>
Co-authored-by: mosfet80 <realeandrea@yahoo.it>
Co-authored-by: PaddleStroke <pierrelouis.boyer@gmail.com>
Co-authored-by: Jed Brown <jed@jedbrown.org>
Co-authored-by: sliptonic <shopinthewoods@gmail.com>
Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
2024-07-30 14:45:59 -06:00

68 lines
1.7 KiB
CMake

include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
if(MSVC)
add_compile_options(/wd4251)
option(
gtest_force_shared_crt
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
ON)
option(gtest_disable_pthreads "Disable uses of pthreads in gtest." ON)
set(Google_Tests_LIBS
oldnames.lib
debug msvcrtd.lib
debug msvcprtd.lib
optimized msvcrt.lib
optimized msvcprt.lib
)
# Universal C runtime introduced in VS 2015 (cl version 19)
if(NOT(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "19"))
list(APPEND Google_Tests_LIBS
debug vcruntimed.lib
debug ucrtd.lib
debug concrtd.lib
optimized vcruntime.lib
optimized ucrt.lib
optimized concrt.lib
)
endif()
endif()
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES)
endif(WIN32)
# Add test executables here
add_executable(test_run)
target_include_directories(
test_run PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../OndselSolver
)
target_sources(test_run
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test.cpp
)
target_link_libraries(test_run
gtest_main
gmock_main
${Google_Tests_LIBS}
OndselSolver
)
include(GoogleTest)
# discovers tests by asking the compiled test executable to enumerate its tests
set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE PRE_TEST)
gtest_discover_tests(test_run)