| ... | @@ -801,31 +801,32 @@ endif() | ... | @@ -801,31 +801,32 @@ endif() |
| 801 | | 801 | |
| 802 | install(TARGETS zig DESTINATION bin) | 802 | install(TARGETS zig DESTINATION bin) |
| 803 | | 803 | |
| 804 | set(ZIG_INSTALL_ARGS "build" | 804 | set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL |
| 805 | --override-lib-dir "${CMAKE_SOURCE_DIR}/lib" | 805 | "Disable copying lib/ files to install prefix during the build phase") |
| 806 | "-Dlib-files-only" | 806 | |
| 807 | --prefix "${CMAKE_INSTALL_PREFIX}" | 807 | if(NOT ZIG_SKIP_INSTALL_LIB_FILES) |
| 808 | "-Dconfig_h=${ZIG_CONFIG_H_OUT}" | 808 | set(ZIG_INSTALL_ARGS "build" |
| 809 | install | 809 | --override-lib-dir "${CMAKE_SOURCE_DIR}/lib" |
| 810 | ) | 810 | "-Dlib-files-only" |
| | 811 | --prefix "${CMAKE_INSTALL_PREFIX}" |
| | 812 | "-Dconfig_h=${ZIG_CONFIG_H_OUT}" |
| | 813 | install |
| | 814 | ) |
| 811 | | 815 | |
| 812 | # CODE has no effect with Visual Studio build system generator, therefore | 816 | # CODE has no effect with Visual Studio build system generator, therefore |
| 813 | # when using Visual Studio build system generator we resort to running | 817 | # when using Visual Studio build system generator we resort to running |
| 814 | # `zig build install` during the build phase. | 818 | # `zig build install` during the build phase. |
| 815 | if(MSVC) | 819 | if(MSVC) |
| 816 | set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL | | |
| 817 | "Windows-only: Disable copying lib/ files to install prefix during the build phase") | | |
| 818 | if(NOT ZIG_SKIP_INSTALL_LIB_FILES) | | |
| 819 | add_custom_target(zig_install_lib_files ALL | 820 | add_custom_target(zig_install_lib_files ALL |
| 820 | COMMAND zig ${ZIG_INSTALL_ARGS} | 821 | COMMAND zig ${ZIG_INSTALL_ARGS} |
| 821 | DEPENDS zig | 822 | DEPENDS zig |
| 822 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" | 823 | WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" |
| 823 | ) | 824 | ) |
| | 825 | else() |
| | 826 | get_target_property(zig_BINARY_DIR zig BINARY_DIR) |
| | 827 | install(CODE "set(zig_EXE \"${ZIG_EXECUTABLE}\")") |
| | 828 | install(CODE "set(ZIG_INSTALL_ARGS \"${ZIG_INSTALL_ARGS}\")") |
| | 829 | install(CODE "set(CMAKE_SOURCE_DIR \"${CMAKE_SOURCE_DIR}\")") |
| | 830 | install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake) |
| 824 | endif() | 831 | endif() |
| 825 | else() | | |
| 826 | get_target_property(zig_BINARY_DIR zig BINARY_DIR) | | |
| 827 | install(CODE "set(zig_EXE \"${ZIG_EXECUTABLE}\")") | | |
| 828 | install(CODE "set(ZIG_INSTALL_ARGS \"${ZIG_INSTALL_ARGS}\")") | | |
| 829 | install(CODE "set(CMAKE_SOURCE_DIR \"${CMAKE_SOURCE_DIR}\")") | | |
| 830 | install(SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake) | | |
| 831 | endif() | 832 | endif() |