| ... | ... | @@ -801,31 +801,32 @@ endif() |
| 801 | 801 | |
| 802 | 802 | install(TARGETS zig DESTINATION bin) |
| 803 | 803 | |
| 804 | | set(ZIG_INSTALL_ARGS "build" |
| 805 | | --override-lib-dir "${CMAKE_SOURCE_DIR}/lib" |
| 806 | | "-Dlib-files-only" |
| 807 | | --prefix "${CMAKE_INSTALL_PREFIX}" |
| 808 | | "-Dconfig_h=${ZIG_CONFIG_H_OUT}" |
| 809 | | install |
| 810 | | ) |
| 804 | set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL |
| 805 | "Disable copying lib/ files to install prefix during the build phase") |
| 806 | |
| 807 | if(NOT ZIG_SKIP_INSTALL_LIB_FILES) |
| 808 | set(ZIG_INSTALL_ARGS "build" |
| 809 | --override-lib-dir "${CMAKE_SOURCE_DIR}/lib" |
| 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 |
| 813 | | # when using Visual Studio build system generator we resort to running |
| 814 | | # `zig build install` during the build phase. |
| 815 | | 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) |
| 816 | # CODE has no effect with Visual Studio build system generator, therefore |
| 817 | # when using Visual Studio build system generator we resort to running |
| 818 | # `zig build install` during the build phase. |
| 819 | if(MSVC) |
| 819 | 820 | add_custom_target(zig_install_lib_files ALL |
| 820 | 821 | COMMAND zig ${ZIG_INSTALL_ARGS} |
| 821 | 822 | DEPENDS zig |
| 822 | 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 | 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 | 832 | endif() |