mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-30 12:59:06 +08:00
47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 3613642..93fb6c1 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -7,6 +7,20 @@ set(SAMPLE_TARGET "test_tinyexr")
|
||
|
|
||
|
project(${BUILD_TARGET} CXX)
|
||
|
|
||
|
+set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed")
|
||
|
+set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed")
|
||
|
+set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Path where headers will be installed")
|
||
|
+set(INSTALL_CMAKE_DIR "share/tinyexr" CACHE PATH "Path where cmake configs will be installed")
|
||
|
+
|
||
|
+# Make relative paths absolute (needed later on)
|
||
|
+set(RELATIVE_INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR})
|
||
|
+foreach(p LIB BIN INCLUDE CMAKE)
|
||
|
+ set(var INSTALL_${p}_DIR)
|
||
|
+ if(NOT IS_ABSOLUTE "${${var}}")
|
||
|
+ set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
|
||
|
+ endif()
|
||
|
+endforeach()
|
||
|
+
|
||
|
# options
|
||
|
option(TINYEXR_BUILD_SAMPLE "Build a sample" ON)
|
||
|
|
||
|
@@ -60,3 +74,20 @@ if (TINYEXR_BUILD_SAMPLE)
|
||
|
endif(WIN32)
|
||
|
|
||
|
endif (TINYEXR_BUILD_SAMPLE)
|
||
|
+
|
||
|
+target_include_directories(${BUILD_TARGET} PUBLIC $<INSTALL_INTERFACE:${RELATIVE_INSTALL_INCLUDE_DIR}> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||
|
+set_target_properties(${BUILD_TARGET} PROPERTIES PUBLIC_HEADER "${PROJECT_SOURCE_DIR}/tinyexr.h")
|
||
|
+
|
||
|
+install(TARGETS ${BUILD_TARGET} EXPORT ${BUILD_TARGET}Targets
|
||
|
+ RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
||
|
+ LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
|
||
|
+ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
||
|
+ PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}"
|
||
|
+ COMPONENT dev
|
||
|
+)
|
||
|
+
|
||
|
+install(EXPORT ${BUILD_TARGET}Targets
|
||
|
+ FILE ${BUILD_TARGET}Config.cmake
|
||
|
+ NAMESPACE unofficial::${BUILD_TARGET}::
|
||
|
+ DESTINATION "${INSTALL_CMAKE_DIR}"
|
||
|
+)
|