[CMake] Semicolons in windows path list for ExternalProject_Add or ExP_Add_Step

Isaiah Norton isaiah.norton at gmail.com
Thu Feb 16 10:37:36 EST 2012


I was using the LIST_SEPARATOR argument in the wrong place when I tried it.
This works as needed:

"""
cmake_minimum_required(VERSION 2.8)
include(ExternalProject)

set(libpath "MORE;BETTER;PATHLIST")
string(REPLACE ";" "^^" libpath "${libpath}")
message("libpath: ${libpath}")
ExternalProject_Add(
  "hello_world"
  URL "C:/temp"
  LIST_SEPARATOR ^^
  BUILD_COMMAND ${CMAKE_BUILD_TOOL}
/p:VCBuildAdditionalLinkLibraryPaths="${libpath}"
  )
"""

On Wed, Feb 15, 2012 at 4:02 PM, Isaiah Norton <isaiah.norton at gmail.com>wrote:

> Hi,
>
> Apologies in advance if I missed/misread something in the FAQ and the
> email threads I've found so far about semicolons. I am using Windows 7
> 64-bit, CMake 2.8.7, and "Visual Studio 10 Win64" generator with msbuild,
> VC++ Express 2010, Windows SDK7.1.
>
> I need to pass a windows-style path list through ExternalProject_Add and
> ExternalProject_Add_Step. Minimal example:
>
> """
> cmake_minimum_required(VERSION 2.8)
> include(ExternalProject)
>
> ExternalProject_Add(
>   "hello_world"
>   URL "C:/temp"
>   BUILD_COMMAND ${CMAKE_BUILD_TOOL}
> "/p:VCBuildAdditionalLinkLibraryPaths=MORE;BETTER;PATHLIST"
>   )
> """
>
> When I generate the project, the path list separator is converted to
> spaces, so when it gets to VCBuild from msbuild it is interpreted as
> multiple arguments and fails.
>
> """ from hello_world.vcxproj:
> ...
> if %errorlevel% neq 0 goto :cmEnd
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe
> /p:VCBuildAdditionalLinkLibraryPaths=MORE BETTER PATHLIST
> if %errorlevel% neq 0 goto :cmEnd
> """
>
> In the real project, I am using $ENV{LIB} (="C:\Program Files
> (x86)\Microsoft Visual Studio 10.0\VC\Lib\amd64;C:\Program Files\Microsoft
> SDKs\Windows\v7.1\Lib\X64;C:\Program Files\Microsoft
> SDKs\Windows\v7.1\Lib\x64")
>
> I've tried string(REPLACE..) for escaping in various ways, but at best I
> end up with extra slashes and at worst no spaces between paths. I also
> tried permutations of "-D" and "LIST_SEPARATOR" to no avail.
>
> Thanks very much for any suggestions.
>
> -Isaiah
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120216/29d86aed/attachment-0001.htm>


More information about the CMake mailing list