Skip to content

Commit

Permalink
Don't redefine Corrosion::Generator target if its already defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
ratmice authored and ogoffart committed Feb 11, 2022
1 parent 0b0b182 commit 48c5814
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cmake/CorrosionConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${PACKAGE_PREFIX_DIR}/@CORROSION_INSTALL_PREFIX@@CMAKE_INSTALL_DATADIR@/cmake")

add_executable(Corrosion::Generator IMPORTED GLOBAL)
if (NOT TARGET Corrosion::Generator)
add_executable(Corrosion::Generator IMPORTED GLOBAL)

if(IS_ABSOLUTE @CMAKE_INSTALL_LIBEXECDIR@)
set(_CORROSION_GENERATOR_DESTINATION "@CMAKE_INSTALL_LIBEXECDIR@")
else()
set(_CORROSION_GENERATOR_DESTINATION "${PACKAGE_PREFIX_DIR}/@CORROSION_INSTALL_PREFIX@@CMAKE_INSTALL_LIBEXECDIR@")
endif()
if(IS_ABSOLUTE @CMAKE_INSTALL_LIBEXECDIR@)
set(_CORROSION_GENERATOR_DESTINATION "@CMAKE_INSTALL_LIBEXECDIR@")
else()
set(_CORROSION_GENERATOR_DESTINATION "${PACKAGE_PREFIX_DIR}/@CORROSION_INSTALL_PREFIX@@CMAKE_INSTALL_LIBEXECDIR@")
endif()

set_property(
TARGET Corrosion::Generator
PROPERTY IMPORTED_LOCATION "${_CORROSION_GENERATOR_DESTINATION}/corrosion-generator")
set_property(
TARGET Corrosion::Generator
PROPERTY IMPORTED_LOCATION "${_CORROSION_GENERATOR_DESTINATION}/corrosion-generator")
endif()

include(Corrosion)

0 comments on commit 48c5814

Please sign in to comment.