Skip to content

Commit

Permalink
try to link pthread on ubuntu20
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuecheng Yu authored and Yuecheng Yu committed Feb 23, 2024
1 parent ba6eeb9 commit 9a066e6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Code/Source/svFSI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ endif()
# unit tests and Google Test
if(ENABLE_UNIT_TEST)
# Force Google Test to use pthreads (for ubuntu20)
add_definitions(-DGTEST_HAS_PTHREAD=1)
# add_definitions(-DGTEST_HAS_PTHREAD=1)
add_compile_definitions(GTEST_HAS_PTHREAD=1)

# Find pthreads package
find_package(Threads REQUIRED)
Expand All @@ -283,10 +284,12 @@ if(ENABLE_UNIT_TEST)
hello_test
../../../tests/unitTests/hello_test.cpp
)
target_compile_definitions(hello_test PRIVATE GTEST_HAS_PTHREAD=1)
target_link_libraries(
hello_test
GTest::gtest_main
Threads::Threads # link threads library
pthread
)
# gtest_discover_tests(hello_test)
add_test(NAME GTestSample COMMAND hello_test)
Expand Down Expand Up @@ -317,11 +320,15 @@ if(ENABLE_UNIT_TEST)
)

# link Google Test
target_compile_definitions(runUnitTest PRIVATE GTEST_HAS_PTHREAD=1)
target_link_libraries(
runUnitTest
GTest::gtest_main
Threads::Threads # link threads library
pthread
)
target_compile_definitions(runUnitTest PRIVATE GTEST_HAS_PTHREAD=1)

# gtest_discover_tests(runUnitTest)
add_test(NAME UnitTest COMMAND runUnitTest)

Expand Down

0 comments on commit 9a066e6

Please sign in to comment.