瀏覽代碼

[cmake] Standardise install tree for windows build (#709)

* [cmake] Standardise install tree for windows build

For cmake builds using MSVC, it now installs in with the same install
tree as the package from the visual studio sln build.
This means that the visual studio hlc templates can now also support
cmake installs of hashlink.

* [cmake] Add default windows install path
tobil4sk 1 年之前
父節點
當前提交
98addf9a99
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      CMakeLists.txt

+ 9 - 0
CMakeLists.txt

@@ -347,6 +347,15 @@ endif()
 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
 set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
 
 
+if(MSVC)
+    if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+        set (CMAKE_INSTALL_PREFIX "C:/HaxeToolkit/hashlink" CACHE PATH "default install path" FORCE)
+    endif()
+
+    set(CMAKE_INSTALL_BINDIR .)
+    set(CMAKE_INSTALL_LIBDIR .)
+endif()
+
 set(HDLL_DESTINATION
 set(HDLL_DESTINATION
     ${CMAKE_INSTALL_LIBDIR}
     ${CMAKE_INSTALL_LIBDIR}
 )
 )