Skip to content
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

Update CMakeLists Targets for integration #1227

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 39 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if(APPLE)
elseif(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions( -DWIN64 )
set( LIBNAME "openvr_api64" )
# set( LIBNAME "openvr_api64" )
endif()
endif()

Expand Down Expand Up @@ -99,11 +99,46 @@ if(USE_CUSTOM_LIBCXX)
endif()

target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS})
target_include_directories(${LIBNAME} PUBLIC ${OPENVR_HEADER_DIR})

install(TARGETS ${LIBNAME} DESTINATION lib)
target_include_directories(${LIBNAME}
PUBLIC
$<BUILD_INTERFACE:${OPENVR_HEADER_DIR}>
$<INSTALL_INTERFACE:include>)
install(FILES ${PUBLIC_HEADER_FILES} DESTINATION include/openvr)

##### Installation targets #####
install(TARGETS ${LIBNAME} EXPORT OpenVRTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)

##### Export files #####
if (WIN32)
set(PKG_PREFIX "cmake")
else ()
set(PKG_PREFIX "lib/cmake/OpenVR")
endif ()

include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_BINARY_DIR}/OpenVRConfigVersion.cmake"
VERSION ${OPENVR_VERSION}
COMPATIBILITY AnyNewerVersion
)

install(EXPORT OpenVRTargets
FILE OpenVRTargets.cmake
NAMESPACE OpenVR::
DESTINATION ${PKG_PREFIX}
)

install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/OpenVRConfig.cmake
${CMAKE_BINARY_DIR}/OpenVRConfigVersion.cmake
DESTINATION ${PKG_PREFIX}
COMPONENT Devel
)


# Generate a .pc file for linux environments
if(PLATFORM_NAME MATCHES "linux")
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
Expand Down
1 change: 1 addition & 0 deletions src/OpenVRConfig.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include("${CMAKE_CURRENT_LIST_DIR}/OpenVRTargets.cmake")