Skip to content

Commit 659a453

Browse files
committedFeb 28, 2024
Update project setup, test for glm 1.0
1 parent 9fce4d4 commit 659a453

File tree

263 files changed

+47
-118024
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+47
-118024
lines changed
 

‎cmake/Findgoogletest.cmake

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# googletest_FOUND
3+
# Target googletest::googletest
4+
5+
include(FindPackageHandleStandardArgs)
6+
7+
find_package(PkgConfig)
8+
pkg_search_module(GMOCK QUIET gmock_main)
9+
10+
find_package_handle_standard_args(googletest REQUIRED_VARS GMOCK_CFLAGS GMOCK_LDFLAGS)
11+
mark_as_advanced(GMOCK_CFLAGS GMOCK_LDFLAGS)
12+
13+
if (googletest_FOUND)
14+
15+
16+
# Create interface library to link against gmock
17+
add_library(googletest::googletest INTERFACE IMPORTED)
18+
19+
target_link_libraries(googletest::googletest
20+
INTERFACE
21+
${GMOCK_LDFLAGS}
22+
)
23+
24+
target_compile_options(googletest::googletest
25+
INTERFACE
26+
${GMOCK_CFLAGS}
27+
)
28+
endif ()

‎source/tests/CMakeLists.txt

+17-28
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ set(META_PROJECT_NAME "glkernel")
1313
project("${META_PROJECT_NAME}-tests" C CXX)
1414

1515
# Set policies
16-
set_policy(CMP0028 NEW) # ENABLE CMP0028: Double colon in target name means ALIAS or IMPORTED target.
1716
set_policy(CMP0054 NEW) # ENABLE CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
1817
set_policy(CMP0042 NEW) # ENABLE CMP0042: MACOSX_RPATH is enabled by default.
1918
set_policy(CMP0063 NEW) # ENABLE CMP0063: Honor visibility properties for all target types.
20-
set_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should not be reserved and should match a validity pattern.
2119

2220
# Compiler settings and options
2321

@@ -41,40 +39,31 @@ function(add_test_without_ctest target)
4139

4240
add_dependencies(test ${target})
4341
add_custom_command(TARGET test POST_BUILD
44-
COMMAND $<TARGET_FILE:${target}> --gtest_output=xml:gtests-${target}.xml)
42+
COMMAND $<TARGET_FILE:${target}> --gtest_output=xml:gtests-${target}.xml
43+
)
4544
endfunction()
4645

47-
# Build gmock
48-
set(gmock_build_tests OFF CACHE BOOL "")
49-
set(gtest_build_samples OFF CACHE BOOL "")
50-
set(gtest_build_tests OFF CACHE BOOL "")
51-
set(gtest_disable_pthreads OFF CACHE BOOL "")
52-
set(gtest_force_shared_crt ON CACHE BOOL "")
53-
set(gtest_hide_internal_symbols OFF CACHE BOOL "")
54-
55-
add_subdirectory(googletest/googlemock)
56-
57-
# Create interface library to link against gmock
58-
add_library(gmock-dev INTERFACE)
59-
60-
target_include_directories(gmock-dev
61-
SYSTEM INTERFACE
62-
${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include
63-
${CMAKE_CURRENT_SOURCE_DIR}/googletest/googlemock/include
64-
)
65-
66-
target_link_libraries(gmock-dev
67-
INTERFACE
68-
gmock
69-
)
46+
find_package(googletest QUIET)
7047

48+
if (NOT TARGET googletest::googletest)
49+
message(STATUS "Tests skipped: googletest not found")
50+
return()
51+
endif ()
7152

7253
#
7354
# Target 'test'
7455
#
7556

76-
add_custom_target(test)
77-
set_target_properties(test PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
57+
if (${CMAKE_VERSION} VERSION_LESS "3.11")
58+
set_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should be reserved and should match a validity pattern.
59+
add_custom_target(test)
60+
set_target_properties(test PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
61+
else ()
62+
if (NOT TARGET test)
63+
add_custom_target(test)
64+
set_target_properties(test PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
65+
endif()
66+
endif ()
7867

7968

8069
#

0 commit comments

Comments
 (0)
Please sign in to comment.