To Reproduce:
./vcpkg install 7zip
Failure logs:
buildtrees/7zip/install-x64-linux-dbg-out.log
[1/259] /usr/bin/c++ -DEXTERNAL_CODECS -DUNICODE -D_7ZIP_LARGE_PAGES -D_UNICODE -fPIC -g /wd5043 -MD -MT CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o -MF CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o.d -o CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o -c /home/nmercer/vcpkg/buildtrees/7zip/src/19.00-d6071f9706.clean/CPP/7zip/Archive/Common/ItemNameUtils.cpp
FAILED: CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o
/usr/bin/c++ -DEXTERNAL_CODECS -DUNICODE -D_7ZIP_LARGE_PAGES -D_UNICODE -fPIC -g /wd5043 -MD -MT CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o -MF CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o.d -o CMakeFiles/7zip.dir/CPP/7zip/Archive/Common/ItemNameUtils.cpp.o -c /home/nmercer/vcpkg/buildtrees/7zip/src/19.00-d6071f9706.clean/CPP/7zip/Archive/Common/ItemNameUtils.cpp
c++: error: /wd5043: No such file or directory
[7/259] ml -DEXTERNAL_CODECS -DUNICODE -D_7ZIP_LARGE_PAGES -D_UNICODE /wd5043 -Dx64 /c /Fo CMakeFiles/7zip.dir/Asm/x86/AesOpt.asm.o /home/nmercer/vcpkg/buildtrees/7zip/src/19.00-d6071f9706.clean/Asm/x86/AesOpt.asm
FAILED: CMakeFiles/7zip.dir/Asm/x86/AesOpt.asm.o
ml -DEXTERNAL_CODECS -DUNICODE -D_7ZIP_LARGE_PAGES -D_UNICODE /wd5043 -Dx64 /c /Fo CMakeFiles/7zip.dir/Asm/x86/AesOpt.asm.o /home/nmercer/vcpkg/buildtrees/7zip/src/19.00-d6071f9706.clean/Asm/x86/AesOpt.asm
/bin/sh: 1: ml: not found
install-x64-linux-dbg-out.log
There are many problems with this cmake file as far as I understood. First of all, the problem that you got is related to the "warning disabled" parameter that was available for only Windows. So, it should be rewritten for Linux. On the other hand, ASM_MASM language option available for only Windows not for Linux. The language option should be parametric even supporting Linux.
Also, I checked that the source code of 7zip is located in a different URL than the current one. So, it has to be compiled /handled explicitly, I guess. So, it takes more time than I expect to figure out how to work in POSIX world.
Hi @nazame
Thanks for posting this issue. Currently, 7ziponly supports windows.
@cngzhnp
Thanks for your above information. It's awesome. We need to update CMakeLists.txt to make it work on both Windows and Linux.
@NancyLi1013 I looked more at this and I think you are right that 7zip only supports windows and I really don't think there is much we can do about it. The source code makes heavy usage of Windows only features. This is supported by the fact that the 7zip tool is only available for windows and in Linux you would instead need to use p7zip which is a port with Linux support.
Personally I just use 7zip for LZMA support, but it looks like if I want my code to be cross-platform I will need to use a different compression library such as liblzma, libarchive, or libzip.
Therefore, I think for this issue, we may just need to add the vcpkg_fail_port_install(ON_TARGET ...) command to the portfile with all non-windows targets.
@nazame
Thanks for your deep investigation for 7zip. I also went through 7zipofficial website and found that there was another archive file for Linux platform. As you said above, it is p7zip. I also checked the archive .The latest version seems a bit older, which is 16.04.
Since they are two different ports, we might consider to add p7zip as a new port if possible. I think your suggestion is suitable and we should add the unsupported message for 7zip.
Most helpful comment
There are many problems with this cmake file as far as I understood. First of all, the problem that you got is related to the "warning disabled" parameter that was available for only Windows. So, it should be rewritten for Linux. On the other hand, ASM_MASM language option available for only Windows not for Linux. The language option should be parametric even supporting Linux.
Also, I checked that the source code of 7zip is located in a different URL than the current one. So, it has to be compiled /handled explicitly, I guess. So, it takes more time than I expect to figure out how to work in POSIX world.