@@ -218,6 +218,8 @@ def test_libs_transitive(self, transitive_libraries, shared):
218218 assert "Conan: Target declared imported STATIC library 'matrix::matrix'" in c .out
219219 assert "Conan: Target declared imported STATIC library 'engine::engine'" in c .out
220220
221+ # if not using cmake >= 3.23 the intermediate gamelib_test linkage fail
222+ @pytest .mark .tool ("cmake" , "3.23" )
221223 @pytest .mark .parametrize ("shared" , [False , True ])
222224 def test_multilevel (self , shared ):
223225 # TODO: make this shared fixtures in conftest for multi-level shared testing
@@ -231,6 +233,28 @@ def test_multilevel(self, shared):
231233
232234 c .save ({}, clean_first = True )
233235 c .run ("new cmake_lib -d name=gamelib -d version=0.1 -d requires=engine/0.1" )
236+
237+ # This specific CMake fails for shared libraries with old CMakeDeps in Linux
238+ cmake = textwrap .dedent ("""\
239+ cmake_minimum_required(VERSION 3.15)
240+ project(gamelib CXX)
241+
242+ find_package(engine CONFIG REQUIRED)
243+
244+ add_library(gamelib src/gamelib.cpp)
245+ target_include_directories(gamelib PUBLIC include)
246+ target_link_libraries(gamelib PRIVATE engine::engine)
247+
248+ add_executable(gamelib_test src/gamelib_test.cpp)
249+ target_link_libraries(gamelib_test PRIVATE gamelib)
250+
251+ set_target_properties(gamelib PROPERTIES PUBLIC_HEADER "include/gamelib.h")
252+ install(TARGETS gamelib)
253+ """ )
254+ # Testing that a local test executable links correctly with the new CMakeDeps
255+ # It fails with the old CMakeDeps
256+ c .save ({"CMakeLists.txt" : cmake ,
257+ "src/gamelib_test.cpp" : '#include "gamelib.h"\n int main() { gamelib(); }' })
234258 c .run (f"create . -o *:shared={ shared } -c tools.cmake.cmakedeps:new={ new_value } " )
235259
236260 c .save ({}, clean_first = True )
0 commit comments