Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fold library locations into CppUTestTargets.cmake.autotools.in
The separate CppUTestTargets-relwithdebinfo.cmake.autotools.in file was
mimicking cmake's multi-configuration pattern, which doesn't apply to
autotools. Autotools produces a single build output, so IMPORTED_LOCATION
(no config suffix) is the correct cmake idiom and works for all
downstream build types.

Move the library locations directly into CppUTestTargets.cmake.autotools.in
and delete the now-unnecessary config-specific template.
  • Loading branch information
thetic committed Mar 3, 2026
commit f76132141673faa2f2badf133c730a08e7924e85
5 changes: 1 addition & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,13 @@ install-data-hook:
$(srcdir)/pkg/CppUTestConfig.cmake.autotools.in \
> "$(DESTDIR)$(cmakedir)/CppUTestConfig.cmake"
sed -e "s|%%PREFIX%%|$(prefix)|g" \
-e "s|%%LIBDIR%%|$(libdir)|g" \
$(srcdir)/pkg/CppUTestTargets.cmake.autotools.in \
> "$(DESTDIR)$(cmakedir)/CppUTestTargets.cmake"
sed -e "s|%%LIBDIR%%|$(libdir)|g" \
$(srcdir)/pkg/CppUTestTargets-relwithdebinfo.cmake.autotools.in \
> "$(DESTDIR)$(cmakedir)/CppUTestTargets-relwithdebinfo.cmake"

uninstall-local:
rm -f "$(DESTDIR)$(cmakedir)/CppUTestConfig.cmake"
rm -f "$(DESTDIR)$(cmakedir)/CppUTestTargets.cmake"
rm -f "$(DESTDIR)$(cmakedir)/CppUTestTargets-relwithdebinfo.cmake"

EXTRA_DIST = \
pkg/cpputest.pc.in \
Expand Down
29 changes: 0 additions & 29 deletions pkg/CppUTestTargets-relwithdebinfo.cmake.autotools.in

This file was deleted.

31 changes: 11 additions & 20 deletions pkg/CppUTestTargets.cmake.autotools.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ add_library(CppUTest::CppUTest STATIC IMPORTED)

set_target_properties(CppUTest::CppUTest PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "%%LIBDIR%%/libCppUTest.a"
)

# Create imported target CppUTest::CppUTestExt
Expand All @@ -59,39 +61,28 @@ add_library(CppUTest::CppUTestExt STATIC IMPORTED)
set_target_properties(CppUTest::CppUTestExt PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "CppUTest::CppUTest"
IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
IMPORTED_LOCATION "%%LIBDIR%%/libCppUTestExt.a"
)

# Load information for each installed configuration.
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/CppUTestTargets-*.cmake")
foreach(_cmake_config_file IN LISTS _cmake_config_files)
include("${_cmake_config_file}")
endforeach()
unset(_cmake_config_file)
unset(_cmake_config_files)

# Cleanup temporary variables.
set(_IMPORT_PREFIX)

# Loop over all imported files and verify that they actually exist
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
if(NOT EXISTS "${_cmake_file}")
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
\"${_cmake_file}\"
# Verify that the library files actually exist.
foreach(_cmake_lib IN ITEMS "%%LIBDIR%%/libCppUTest.a" "%%LIBDIR%%/libCppUTestExt.a")
if(NOT EXISTS "${_cmake_lib}")
message(FATAL_ERROR "The imported target references the file
\"${_cmake_lib}\"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
\"${CMAKE_CURRENT_LIST_FILE}\"
but not all the files it references.
")
endif()
endforeach()
unset(_cmake_file)
unset("_cmake_import_check_files_for_${_cmake_target}")
endif()
endforeach()
unset(_cmake_target)
unset(_cmake_import_check_targets)
unset(_cmake_lib)

# This file does not depend on other imported targets which have
# been exported from the same project but in a separate export set.
Expand Down
Loading