J’ai donc voulu faire l’installation de gtest : https://github.com/google/googletest sur un serveur en Fédora 17 mais sans succès.
# wget https://github.com/google/googletest/archive/master.zip
# unzip master.zip
# cd googletest-master/
# mkdir mybuild
# cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8.8)
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(googletest-distribution)
set(GOOGLETEST_VERSION 1.9.0)
enable_testing()
include(CMakeDependentOption)
include(GNUInstallDirs)
#Note that googlemock target already builds googletest
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
if(BUILD_GMOCK)
add_subdirectory( googlemock )
else()
add_subdirectory( googletest )
endif()
# uname -a
Linux fedora17-64b 3.3.4-5.fc17.x86_64 #1 SMP Mon May 7 17:29:34 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
# rpm -qa | grep "cmake"
cmake-2.8.9-1.fc17.x86_64
# cmake -G"Unix Makefiles" ..
-- The C compiler identification is GNU 4.7.2
-- The CXX compiler identification is GNU 4.7.2
-- Check for working C compiler: /bin/gcc
-- Check for working C compiler: /bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found PythonInterp: /bin/python (found version "2.7.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found.
-- 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 - found
-- Found Threads: TRUE
CMake Error at /usr/share/cmake/Modules/WriteBasicConfigVersionFile.cmake:39 (message):
No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
Call Stack (most recent call first):
/usr/share/cmake/Modules/CMakePackageConfigHelpers.cmake:152 (write_basic_config_version_file)
googletest/CMakeLists.txt:96 (write_basic_package_version_file)
-- Configuring incomplete, errors occurred!
# cat ../CMakeLists.txt
cmake_minimum_required(VERSION 2.8.8)
if (CMAKE_VERSION VERSION_LESS "3.1")
add_definitions(-std=c++11)
else()
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
endif()
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(googletest-distribution)
#set(CMAKE_PROJECT_VERSION_SET_BY_PROJECT_COMMAND FALSE)
set(GOOGLETEST_VERSION 1.9.0)
if("${CVF_VERSION}" STREQUAL "")
if ("${GOOGLETEST_VERSION}" STREQUAL "")
message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
else()
set(CVF_VERSION "${GOOGLETEST_VERSION}")
endif()
endif()
if("${CVF_VERSION}" STREQUAL "")
message(FATAL_ERROR "No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()")
else()
endif()
enable_testing()
include(CMakeDependentOption)
include(GNUInstallDirs)
#Note that googlemock target already builds googletest
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON)
if(BUILD_GMOCK)
add_subdirectory( googlemock )
else()
add_subdirectory( googletest )
endif()
Dans le fichier la version minimum semble être 2.8.8 et j’ai la version 2.8.9-1. J’ai essayé de forcer la variable mais sans succès.
J’ai donc essayé de faire une « build » avec seulement GMOCK mais sans succès.
# cmake -DBUILD_GTEST=OFF -DBUILD_GMOCK=ON -DINSTALL_GTEST=OFF -DINSTALL_GMOCK=ON
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_GTEST
INSTALL_GMOCK
-- Build files have been written to: /root/googletest-master
# make
Scanning dependencies of target gtest
[ 5%] Building CXX object googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o
In file included from /root/googletest-master/googletest/include/gtest/internal/gtest-internal.h:40:0,
from /root/googletest-master/googletest/include/gtest/gtest.h:60,
from /root/googletest-master/googletest/src/gtest-all.cc:38:
/root/googletest-master/googletest/include/gtest/internal/gtest-port.h:2307:1: error: expected unqualified-id before ‘[’ token
In file included from /root/googletest-master/googletest/include/gtest/gtest.h:60:0,
from /root/googletest-master/googletest/src/gtest-all.cc:38:
/root/googletest-master/googletest/include/gtest/internal/gtest-internal.h: In member function ‘bool testing::internal::TypedTestCasePState::AddTestName(const char*, int, const char*, const char*)’:
/root/googletest-master/googletest/include/gtest/internal/gtest-internal.h:554:7: error: ‘Abort’ is not a member of ‘testing::internal::posix’
/root/googletest-master/googletest/include/gtest/internal/gtest-internal.h: In static member function ‘static bool testing::internal::TypeParameterizedTestCase<Fixture, Tests, Types>::Register(const char*, testing::internal::CodeLocation, const testing::internal::TypedTestCasePState*, const char*, const char*, const std::vector<std::basic_string<char> >&)’:
/root/googletest-master/googletest/include/gtest/internal/gtest-internal.h:718:7: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/include/gtest/gtest-param-test.h:188:0,
from /root/googletest-master/googletest/include/gtest/gtest.h:65,
from /root/googletest-master/googletest/src/gtest-all.cc:38:
/root/googletest-master/googletest/include/gtest/internal/gtest-param-util.h: In member function ‘testing::internal::ParameterizedTestCaseInfo<TestCase>* testing::internal::ParameterizedTestCaseRegistry::GetTestCasePatternHolder(const char*, testing::internal::CodeLocation)’:
/root/googletest-master/googletest/include/gtest/internal/gtest-param-util.h:686:11: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/src/gtest-all.cc:41:0:
/root/googletest-master/googletest/src/gtest.cc: In member function ‘const testing::TestPartResult& testing::TestResult::GetTestPartResult(int) const’:
/root/googletest-master/googletest/src/gtest.cc:2070:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
/root/googletest-master/googletest/src/gtest.cc: In member function ‘const testing::TestProperty& testing::TestResult::GetTestProperty(int) const’:
/root/googletest-master/googletest/src/gtest.cc:2079:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/src/gtest-all.cc:42:0:
/root/googletest-master/googletest/src/gtest-death-test.cc: In function ‘void testing::internal::DeathTestAbort(const string&)’:
/root/googletest-master/googletest/src/gtest-death-test.cc:301:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/src/gtest-all.cc:45:0:
/root/googletest-master/googletest/src/gtest-port.cc: In destructor ‘testing::internal::GTestLog::~GTestLog()’:
/root/googletest-master/googletest/src/gtest-port.cc:983:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/src/gtest-all.cc:47:0:
/root/googletest-master/googletest/src/gtest-test-part.cc: In member function ‘const testing::TestPartResult& testing::TestPartResultArray::GetTestPartResult(int) const’:
/root/googletest-master/googletest/src/gtest-test-part.cc:70:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
In file included from /root/googletest-master/googletest/src/gtest-all.cc:48:0:
/root/googletest-master/googletest/src/gtest-typed-test.cc: In member function ‘const char* testing::internal::TypedTestCasePState::VerifyRegisteredTestNames(const char*, int, const char*)’:
/root/googletest-master/googletest/src/gtest-typed-test.cc:109:5: error: ‘Abort’ is not a member of ‘testing::internal::posix’
make[2]: *** [googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o] Error 1
make[1]: *** [googlemock/gtest/CMakeFiles/gtest.dir/all] Error 2
make: *** [all] Error 2
Sniff.