# CMake 4 removed CMP0026 OLD outright -- asking for it is now a hard error, not a
# deprecation -- so the LOCATION property of a target can no longer be read at
# configure time. Nothing here ever wanted the location: the very next line reduced
# it to the file NAME, and that name is fully determined by the target's OUTPUT_NAME
# plus the platform's shared library prefix and suffix. So it is built directly, and
# the result is the same on both platforms: libtoltcl4.1.dll and libtoltcl4.1.so.
#
# A generator expression is not an option here because pkgIndex.tcl is produced by
# configure_file, which runs before generate time.
get_target_property( TOLTCL_OUTPUT_NAME toltcl OUTPUT_NAME )
set( TOLTCL_LIB_NAME
  "${CMAKE_SHARED_LIBRARY_PREFIX}${TOLTCL_OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" )
message( STATUS "TOLTCL_LIB_NAME = ${TOLTCL_LIB_NAME}" )

configure_file (
  "${CMAKE_CURRENT_SOURCE_DIR}/pkgIndex.tcl.in"
  "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl"
  )

install( FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgIndex.tcl" toltcl.tcl tolsh.tcl
  COMPONENT RUNTIME DESTINATION "${TOLTCL_DEST_DIR}" )

