I am trying to build an external library using ExternalProject_Add. I am getting the Project file does not exist error while building with MS Visual Studio.
MSBuild version 17.7.2+d6990bcfa for .NET Framework
Checking Build System
Performing update step for 'poissonRecon'
No patch step for 'poissonRecon'
Performing configure step for 'poissonRecon'
-- Configuring done (0.0s)
-- Generating done (0.1s)
-- Build files have been written to: C:/qlabRoot/build/External/poissonRecon/poissonRecon
Performing build step for 'poissonRecon'
MSBuild version 17.7.2+d6990bcfa for .NET Framework
QPOISSON_RECON_LIB.vcxproj -> C:\qlabRoot\build\External\poissonRecon\poissonRecon\Debug\QPOISSON_RECON_LIB.lib
Performing install step for 'poissonRecon'
MSBuild version 17.7.2+d6990bcfa for .NET Framework
C:\qlabRoot\projects\CommonExternal\MSBUILD : error MSB1009: Project file does not exist.
Can someone please provide some insight about the cause of this error?
I added “INSTALL_COMMAND cmake --install <BINARY_DIR>” within the ExternalProject_Add and that built without errors.
(1) Can you please explain why this results in no errors while earlier without it, the error I originally reported was getting triggered? I would like to understand this clearly so I can debug and fix issues like this in future.
(2) In the output window, I see the following. I am building the debug configuration, but, the line there says Install configuration: “Release”
My guess is that the BINARY_DIR setting with a genex is confusing things. This is probably worth an issue with a minimal reproducer to update docs or the implementation, depending on the root cause.
The INSTALL_DIR option is not the most intuitive. It does NOT control where things are installed. All it does is provide a value for the <INSTALL_DIR> placeholder. It is up to the project to provide an INSTALL_COMMAND if they want to install to anywhere other than the default location.
I’ve often found this behavior to be really unintuitive. It would be nice to eventually make INSTALL_DIR affect where things get installed if the INSTALL_COMMAND isn’t given, but I suspect there are difficulties with the implementation of that. I don’t have the bandwidth to pursue this one, but if someone wants to investigate and put up a merge request, I’ll make time to review it.
I don’t think INSTALL_DIR is relevant here as it seems to be the working directory of the command which is confused (based on the “no such .*proj file” error at least). That’s why I think a minimal reproducer would be good to have here (this starts off really close to one; I think a “dummy” project may be more suitable though).
To create a minimal reproducer, I just placed the CMakeLists.txt I had posted in my original post above in a separate folder to make it a stand-alone file. With that I still get an error, though the error now is error : unknown target ‘install’
I am pasting below the CMakeLists.txt again as a minimal reproducer example. I am building this on a Windows 11 machine using the latest version (17.7.3) of Microsoft Visual Studio 2022 Community Edition.