Skip to content

Commit

Permalink
Fix Cmake package return info
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-penev authored and vgvassilev committed Nov 19, 2023
1 parent 8c11589 commit 4eac1ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ include_directories(BEFORE SYSTEM
)


file(READ "VERSION" CPPINTEROP_VERSION)
file(STRINGS "VERSION" CPPINTEROP_VERSION)
string(REGEX MATCH "([0-9]*)\.([0-9]*)\.([0-9]*)" CPPINTEROP_VERSION_ONLY "${CPPINTEROP_VERSION}")
set(CPPINTEROP_VERSION_MAJOR "${CMAKE_MATCH_1}")
set(CPPINTEROP_VERSION_MINOR "${CMAKE_MATCH_2}")
Expand Down
14 changes: 9 additions & 5 deletions cmake/CppInterOp/CppInterOpConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,30 @@ get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}"

if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include")
set(_include "${CPPINTEROP_INSTALL_PREFIX}/include")
set(_libs "${CPPINTEROP_INSTALL_PREFIX}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}")
else()
set(_include "@CMAKE_CURRENT_SOURCE_DIR@/include")
set(_libs "@CMAKE_CURRENT_SOURCE_DIR@/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangCppInterOp${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()

if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/cmake")
set(_cmake "${CPPINTEROP_INSTALL_PREFIX}/cmake")
if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/lib/cmake/CppInterOp")
set(_cmake "${CPPINTEROP_INSTALL_PREFIX}/lib/cmake/CppInterOp")
else()
set(_cmake "@CMAKE_CURRENT_SOURCE_DIR@/cmake")
set(_cmake "@CMAKE_CURRENT_SOURCE_DIR@/cmake/CppInterOp")
endif()

###

set(CPPINTEROP_EXPORTED_TARGETS "clangCppInterOp")
set(CPPINTEROP_CMAKE_DIR "${_cmake}")
set(CPPINTEROP_INCLUDE_DIRS "${_include}")
set(CPPINTEROP_LIBRARIES "${_libs}")

# Provide all our library targets to users.
add_library(clangCppInterOp SHARED IMPORTED)
set_property(TARGET clangCppInterOp PROPERTY IMPORTED_LOCATION "${CPPINTEROP_DIR}/lib/libclangCppInterOp.so")
set_property(TARGET clangCppInterOp PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}")
set_property(TARGET clangCppInterOp PROPERTY IMPORTED_LOCATION "${_libs}")

unset(_include)
unset(_cmake)
unset(_include)
unset(_libs)

0 comments on commit 4eac1ca

Please sign in to comment.