Skip to content

Fix Cmake package return info #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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)