Fix platform dependent cmake

This commit is contained in:
Pascal Serrarens 2023-05-01 10:17:52 +02:00
parent 986d3fdb13
commit 52a8df8c69

View File

@ -1,42 +1,52 @@
cmake_minimum_required(VERSION 3.13) # CMake version check cmake_minimum_required(VERSION 3.13) # CMake version check
#project(VectorAlgebra) # Create project "simple_example" if(ESP_PLATFORM)
set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#add_compile_definitions(GTEST)
#include(FetchContent)
#FetchContent_Declare(
# googletest
# URL https://github.com/google/googletest/archive/refs/heads/main.zip
#)
# For Windows: Prevent overriding the parent project's compiler/linker settings
#set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
#FetchContent_MakeAvailable(googletest)
#include_directories(include)
idf_component_register( idf_component_register(
SRC_DIRS "src" SRC_DIRS "src"
INCLUDE_DIRS "include" INCLUDE_DIRS "include"
) )
else()
project(VectorAlgebra) # Create project "simple_example"
#add_library(VectorAlgebra STATIC "src/FloatSingle.cpp" "src/Angle.cpp" "src/Vector2.cpp" "src/Vector3.cpp" "src/Quaternion.cpp" ) set(CMAKE_CXX_STANDARD 11) # Enable c++11 standard
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#enable_testing() add_compile_definitions(GTEST)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/heads/main.zip
)
#add_executable( # For Windows: Prevent overriding the parent project's compiler/linker settings
# VectorAlgebraTest set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# "test/Angle_test.cc" FetchContent_MakeAvailable(googletest)
# "test/FloatSingle_test.cc" include_directories(include)
# "test/Vector2_test.cc"
# "test/Vector3_test.cc" add_library(VectorAlgebra STATIC
# "test/Quaternion_test.cc" "src/FloatSingle.cpp"
# ) "src/Angle.cpp"
#target_link_libraries( "src/Vector2.cpp"
# VectorAlgebraTest "src/Vector3.cpp"
# #gtest_main "src/Quaternion.cpp"
# VectorAlgebra )
#)
enable_testing()
add_executable(
VectorAlgebraTest
"test/Angle_test.cc"
"test/FloatSingle_test.cc"
"test/Vector2_test.cc"
"test/Vector3_test.cc"
"test/Quaternion_test.cc"
)
target_link_libraries(
VectorAlgebraTest
#gtest_main
VectorAlgebra
)
include(GoogleTest)
gtest_discover_tests(VectorAlgebraTest)
endif()
#include(GoogleTest)
#gtest_discover_tests(VectorAlgebraTest)