Skip to content

cmake: Install export is broken with abseil-cpp 20240116.0 #4079

@Mizux

Description

@Mizux

Our current install is not working, it seems absl is pulling GTest::gmock (even with BUILD_TESTING=OFF) while googletest is not part of our export (we don't install any "test" libraries so no point to depends on it + this add a dependency to find_package(ortools))

This is related to:

trace:

#15 0.541 CMake Error at /usr/share/cmake/Modules/CMakeFindDependencyMacro.cmake:76 (find_package):
#15 0.541   Found package configuration file:
#15 0.541 
#15 0.541     /usr/local/lib/cmake/absl/abslConfig.cmake
#15 0.541 
#15 0.541   but it set absl_FOUND to FALSE so package "absl" is considered to be NOT
#15 0.541   FOUND.  Reason given by package:
#15 0.541 
#15 0.541   The following imported targets are referenced, but are missing:
#15 0.541   GTest::gmock

ref: https://github.com/google/or-tools/actions/runs/7868730029/ (all cpp jobs are failling in cpp_install_test stage since the abseil-cpp bump)

On my way (since friday -_-) to fix it...

DevNote:

Performing a local install to investigate

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBUILD_DEPS=ON
cmake --build build -j 8 -v

# install in build/install
cmake --build build --target install -- DESTDIR=install

Upon inspection:

grep -in -C 4 "gmock" build/install/usr/local/lib/cmake/absl/abslTargets.cmake
348-
349-set_target_properties(absl::test_allocator PROPERTIES
350-  INTERFACE_COMPILE_FEATURES "cxx_std_17"
351-  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
352:  INTERFACE_LINK_LIBRARIES "absl::config;GTest::gmock"
353-  INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "include"
354-)
355-
356-# Create imported target absl::flat_hash_map
--
1941-
1942-# Make sure the targets which have been exported in some other
1943-# export set exist.
1944-unset(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets)
1945:foreach(_target "GTest::gmock" )
1946-  if(NOT TARGET "${_target}" )
1947-    set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets "${${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE_targets} ${_target}")
1948-  endif()
1949-endforeach()

thus absl::test_allocator pull GTest::gmock, and this target is not flagged as TESTONLY in the abseil-cpp source...
EDIT: fixed upstream by abseil/abseil-cpp@779a356

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions