Failed to configure CMake project with GoogleTest dependency from terminal.
The main root CMakeList.txt
cmake_minimum_required (VERSION 3.8)
# Fix "is not able to compile a simple test program."
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(COMMON_PROJECT_CPP_STANDARD 20 ON CACHE BOOL "" FORCE)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.13.0.zip
DOWNLOAD_EXTRACT_TIMESTAMP ON
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
project ("DataStructuresAndAlgorithms")
enable_testing()
add_subdirectory ("src/BubbleSort")
The BubbleSort CMakeList.txt
project("BubbleSort")
add_executable(
${PROJECT_NAME}
"bubblesort.test.cpp"
"bubblesort.h"
)
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD ${COMMON_PROJECT_CPP_STANDARD})
endif()
# GoogleTest requires at least C++14
target_link_libraries(
${PROJECT_NAME}
GTest::gtest_main
)
include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME})
Steps to reproduce the problem
Configure project
PS D:\0my\pr0jects\CnC++\DataStructuresAndAlgorithms> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/cmake/win/x64/bin/cmake.exe" -DCMAKE_SYSTEM_NAME="Windows" -DCMAKE_POLICY_DEFAULT_CMP0025="NEW" -DCMAKE_MAKE_PROGRAM="E:/Programs/JetBrains/CLion 2023.1.1/bin/ninja/win/x64/ninja.exe" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER="E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/gcc.exe" -DCMAKE_CXX_COMPILER="E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/g++.exe" -G Ninja -S D:/0my/pr0jects/CnC++/DataStructuresAndAlgorithms -B D:/0my/pr0jects/CnC++/DataStructuresAndAlgorithms/mybuild/x64-win-debug-mingw-coverage
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
CMake Warning (dev) at E:/Programs/JetBrains/CLion 2023.1.1/bin/cmake/win/x64/share/cmake-3.25/Modules/GNUInstallDirs.cmake:243 (message):
Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
target architecture is known. Please enable at least one language before
including GNUInstallDirs.
Call Stack (most recent call first):
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/CMakeLists.txt:28 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Found Python: E:/Programs/Python/Python311/python.exe (found version "3.11.3") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - no
-- Found Threads: TRUE
CMake Error at mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:200 (target_compile_features):
target_compile_features no known features for CXX compiler
""
version .
Call Stack (most recent call first):
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:213 (cxx_library_with_type)
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/CMakeLists.txt:126 (cxx_library)
CMake Error at mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:200 (target_compile_features):
target_compile_features no known features for CXX compiler
""
version .
Call Stack (most recent call first):
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:213 (cxx_library_with_type)
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/CMakeLists.txt:144 (cxx_library)
CMake Error at mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:200 (target_compile_features):
target_compile_features no known features for CXX compiler
""
version .
Call Stack (most recent call first):
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:213 (cxx_library_with_type)
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googlemock/CMakeLists.txt:97 (cxx_library)
CMake Error at mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:200 (target_compile_features):
target_compile_features no known features for CXX compiler
""
version .
Call Stack (most recent call first):
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googletest/cmake/internal_utils.cmake:213 (cxx_library_with_type)
mybuild/x64-win-debug-mingw-coverage/_deps/googletest-src/googlemock/CMakeLists.txt:100 (cxx_library)
-- Configuring incomplete, errors occurred!
See also "D:/0my/pr0jects/CnC++/DataStructuresAndAlgorithms/mybuild/x64-win-debug-mingw-coverage/CMakeFiles/CMakeOutput.log".
See also "D:/0my/pr0jects/CnC++/DataStructuresAndAlgorithms/mybuild/x64-win-debug-mingw-coverage/CMakeFiles/CMakeError.log".
What version of GoogleTest are you using?
v1.13.0
What operating system and version are you using?
Windows 11 Pro 22H2 x64
OS build 22621.2283
What compiler and version are you using?
from CLion toolchain
PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/gcc.exe" -v
gcc version 11.2.0 (GCC)
PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/g++.exe" -v
gcc version 11.2.0 (GCC)
What build system are you using?
PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/cmake/win/x64/bin/cmake.exe" --version
cmake version 3.25.2 (CMake; JetBrains IDE bundle; build 4)
PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/ninja/win/x64/ninja.exe" --version
1.10.2
Describe the issue
Failed to configure CMake project with GoogleTest dependency from terminal.
The main root CMakeList.txt
The BubbleSort CMakeList.txt
Steps to reproduce the problem
Configure project
What version of GoogleTest are you using?
v1.13.0
What operating system and version are you using?
Windows 11 Pro 22H2 x64 OS build 22621.2283
What compiler and version are you using?
from CLion toolchain PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/gcc.exe" -v gcc version 11.2.0 (GCC) PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/mingw/bin/g++.exe" -v gcc version 11.2.0 (GCC)
What build system are you using?
PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/cmake/win/x64/bin/cmake.exe" --version cmake version 3.25.2 (CMake; JetBrains IDE bundle; build 4) PS C:\Users\User0> ."E:/Programs/JetBrains/CLion 2023.1.1/bin/ninja/win/x64/ninja.exe" --version 1.10.2
Additional context
No response