ExternalProject_Add Visual Studio build Install Target

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ExternalProject_Add Visual Studio build Install Target

J Decker
I've had to make this modification the last few versions...

cmake/share/cmake-3.14/Modules/ExternalProject.cmake

line 1870 from

      if(step STREQUAL "INSTALL")
        list(APPEND args --target install)
      endif()

to

      if(step STREQUAL "INSTALL")
        list(APPEND args --target INSTALL)
      endif()

Otherwise, when building with visual studio, and trying to run the <project>-install.rule  rule, it says 'no such project'

I don't think the same issue happens when building from the command line.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProject_Add Visual Studio build Install Target

J Decker
Why does it seem I'm the only one with this problem?
I've recently updated this other portable system while I'm on the road, and the latest version of course fails the same way.

---- The Current build output

1>------ Build started: Project: intershell (ExternalProjectTargets\intershell\intershell), Configuration: RelWithDebInfo x64 ------
1>  Performing install step for 'intershell'
1>  Microsoft (R) Build Engine version 14.0.23107.0
1>  Copyright (C) Microsoft Corporation. All rights reserved.
1>
1>MSBUILD : error MSB1009: Project file does not exist.
1>  Switch: install
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

-----
share\cmake-3.15\Modules\ExternalProject.cmake
line 1853

      if(step STREQUAL "INSTALL")
        list(APPEND args --target install)
      endif()


Change to
      if(step STREQUAL "INSTALL")
        list(APPEND args --target INSTALL)
      endif()

 -------------------

And then the output looks like
 --------------
1>------ Build started: Project: intershell (ExternalProjectTargets\intershell\intershell), Configuration: RelWithDebInfo x64 ------
1>  Performing install step for 'intershell'
1>  Microsoft (R) Build Engine version 14.0.23107.0
1>  Copyright (C) Microsoft Corporation. All rights reserved.
1>
1>    InterShell.Service.vcxproj -> M:\javascript\sack-gui\build\sack-src\src\intershell-build\service.shell\RelWithDebInfo\InterShell.Service.exe
..........
(completes successfully )



On Thu, Apr 25, 2019 at 1:27 AM J Decker <[hidden email]> wrote:
I've had to make this modification the last few versions...

cmake/share/cmake-3.14/Modules/ExternalProject.cmake

line 1870 from

      if(step STREQUAL "INSTALL")
        list(APPEND args --target install)
      endif()

to

      if(step STREQUAL "INSTALL")
        list(APPEND args --target INSTALL)
      endif()

Otherwise, when building with visual studio, and trying to run the <project>-install.rule  rule, it says 'no such project'

I don't think the same issue happens when building from the command line.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProject_Add Visual Studio build Install Target

J Decker

On Sat, Aug 31, 2019 at 9:56 PM J Decker <[hidden email]> wrote:
Why does it seem I'm the only one with this problem?

This is an external CMakeLists.txt that fails.
---- 
cmake_minimum_required(VERSION 3.15)

set_property(GLOBAL PROPERTY USE_FOLDERS On)

project( B )
include( ExternalProject )

add_executable( b b.c )

###### Specifically this line causes the fails #############
SET_TARGET_PROPERTIES(b PROPERTIES FOLDER "install" )

install( TARGETS b )
-----

 



A full Test  ...
--- CMakeLists.txt---
cmake_minimum_required(VERSION 3.15)

if( NOT EXISTS b )
file(MAKE_DIRECTORY b)
file( WRITE b/b.c "#include <stdio.h>\nint main(void) { printf( \"Program.\\n\" ); }" )
file( WRITE b/CMakeLists.txt  "cmake_minimum_required(VERSION 3.15)\n\nset_property(GLOBAL PROPERTY USE_FOLDERS On)\n\nproject( B )\ninclude( ExternalProject )\n\nadd_executable( b b.c )\nSET_TARGET_PROPERTIES(b PROPERTIES\n                  FOLDER \"install\" )\n\ninstall( TARGETS b )\n" )

endif( NOT EXISTS b )

set_property(GLOBAL PROPERTY USE_FOLDERS On)

project( Test )

include( ExternalProject )

ExternalProject_Add( b
        PREFIX b-src
SOURCE_DIR ${CMAKE_SOURCE_DIR}/b
BINARY_DIR b_exe
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
        BUILD_ALWAYS 1
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:PATH=${CMAKE_BUILD_TYPE}
)

--- End CMakeLists.txt---

mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=output
cmake --build . --target install

Error Output:
 MSBUILD : error MSB1009: Project file does not exist. [M:\tmp\cmake_vs_install\build\b.vcxproj]
  Switch: install


-----------

  SET_TARGET_PROPERTIES(b PROPERTIES FOLDER "Install" ) # capitalize I bypasses the issue
  SET_TARGET_PROPERTIES(b PROPERTIES FOLDER "Install and Deploy" ) # make it really log also bypasses the issue...

otherwise capitalizing --target INSTALL in the ExternalProject.cmake, for visual studio, also fixed the problem, since the real target is 'INSTALL' and not 'install'


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake