添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
开朗的路灯  ·  googletest/googletest/ ...·  3 周前    · 
文雅的开水瓶  ·  warning: relocation ...·  2 周前    · 
不爱学习的柠檬  ·  GitHub - ...·  1 周前    · 
很酷的生菜  ·  Function Interface in ...·  7 月前    · 
威武的灯泡  ·  Android Native ...·  8 月前    · 
正直的钥匙扣  ·  Windows ...·  9 月前    · 

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?

My CMakeLists.txt file:

cmake_minimum_required(VERSION 3.24)
project(poissonRecon)
include(ExternalProject)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT isMultiConfig)
  if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE
        Debug
        CACHE STRING "" FORCE)
  endif ()
  set(build_type_dir ${CMAKE_BUILD_TYPE})
  set(build_type_arg -DCMAKE_BUILD_TYPE=$<CONFIG>)
else ()
  set(build_config_arg --config=$<CONFIG>)
endif ()
ExternalProject_Add(
  poissonRecon
  GIT_REPOSITORY https://github.com/CloudCompare/PoissonRecon.git
  GIT_TAG 85c010229a1c5f2e186488290c2f93fec7da4ad5 
  BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/poissonRecon/${build_type_dir}
  INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/poissonRecon/${CMAKE_BUILD_TYPE}
  CMAKE_COMMAND ${CMAKE_COMMAND}
  CMAKE_ARGS ${build_type_arg} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
  BUILD_COMMAND cmake --build <BINARY_DIR> ${build_config_arg}
              

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”

  QPOISSON_RECON_LIB.vcxproj -> C:\qlabRoot\build\External\poissonRecon\poissonRecon\Debug\QPOISSON_RECON_LIB.lib
Performing install step for 'poissonRecon'
-- Install configuration: "Release"

Thanks!

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.

Cc: @craig.scott

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.

cmake_minimum_required(VERSION 3.24)
project(poissonRecon)
include(ExternalProject)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (NOT isMultiConfig)
  if (NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE
        Debug
        CACHE STRING "" FORCE)
  endif ()
  set(build_type_dir ${CMAKE_BUILD_TYPE})
  set(build_type_arg -DCMAKE_BUILD_TYPE=$<CONFIG>)
else ()
  set(build_config_arg --config=$<CONFIG>)
endif ()
message("poissonRecon: CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("poissonRecon: CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
message("poissonRecon: CMAKE_CURRENT_BINARY_DIR: ${CMAKE_CURRENT_BINARY_DIR}")
ExternalProject_Add(
  poissonRecon
  GIT_REPOSITORY https://github.com/CloudCompare/PoissonRecon.git
  GIT_TAG 85c010229a1c5f2e186488290c2f93fec7da4ad5 
  BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/poissonRecon/${build_type_dir}
  INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/poissonRecon/${CMAKE_BUILD_TYPE}
  CMAKE_COMMAND ${CMAKE_COMMAND}
  CMAKE_ARGS ${build_type_arg} -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
  BUILD_COMMAND cmake --build <BINARY_DIR>  ${build_config_arg}