[CMake] Problem with quotes in ExternalProject
Milutin Jovanović
jovanovic.milutin at gmail.com
Thu Oct 20 16:35:01 EDT 2011
Hi all,
I am sorry for dragging you all back into the quote problem, but I've just
spent 4 hours on ONE SET OF QUOTES!!! Sorry, had to get that out of the
system. I promise no more.
Any way, I am using ExternalProject, which downloads and builds couple of
projects. The problem is on Windows, where I am trying to invoke msbuild on
a MSVC solution that is included in the source archive. I am attaching the
cmake file for your reference.
Well, in it there are two external projects, first one builds fine, since I
do not have to pass it any complex parameters. But, for the second, I have
to expand its include list to point to the first one, and here I am having
trouble. The command in question is, specifically the BUILD_COMMAND and the
quotes in the /p:IncludePath argument:
ExternalProject_Add(
libvorbis
# LIST_SEPARATOR ::
DEPENDS libogg
PREFIX libvorbis
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
URL_MD5 798a4211221073c1409f26eac4567e8b
#CONFIGURE_COMMAND rem nop
CONFIGURE_COMMAND echo msbuild
win32/vs2010/libvorbis/libvorbis_static.vcxproj /t:Build
/p:Configuration=${CMAKE_BUILD_TYPE}
/p:IncludePath="$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
BUILD_COMMAND msbuild win32/vs2010/libvorbis/libvorbis_static.vcxproj
/t:Build /p:Configuration=${CMAKE_BUILD_TYPE}
/p:IncludePath="$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
INSTALL_COMMAND rem nop
BUILD_IN_SOURCE 1
)
I am trying to make the argument on the command line to look like
/p:IncludePath="$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
but no matter what I do, it does not work. I tried:
/p:IncludePath=$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/
/p:IncludePath="$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
"/p:IncludePath="$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/""
"/p:IncludePath=\"$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/\""
\"/p:IncludePath=\"$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/\"\"
"/p:IncludePath=\\"$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/\\""
and probably few more, but I always either get something unusable. My best
guess was:
"/p:IncludePath=\"$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/\""
Quotes around the whole argument, and then escaping the inner quotes. But
very surprisingly I get:
/p:IncludePath=\"$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/\"
So, please, help. I am sure that in my frustration I forgot something
obvious...
Miki.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111020/9badba37/attachment.htm>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Path where to install.")
project(dependecies)
include(ExternalProject)
if(WIN32)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
ExternalProject_Add(
libogg
PREFIX libogg
URL http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
URL_MD5 0a7eb40b86ac050db3a789ab65fe21c2
CONFIGURE_COMMAND rem nop
BUILD_COMMAND msbuild win32/vs2010/libogg_static.sln /t:Build /p:Configuration=${CMAKE_BUILD_TYPE}
INSTALL_COMMAND rem nop
BUILD_IN_SOURCE 1
)
add_custom_command(
TARGET libogg POST_BUILD
COMMAND cmake -E make_directory include/ogg
)
add_custom_command(
TARGET libogg POST_BUILD
COMMAND cmake -E make_directory lib
)
add_custom_command(
TARGET libogg POST_BUILD
COMMAND cmake -E copy_if_different libogg/src/libogg/include/ogg/ogg.h include/ogg/ogg.h
)
add_custom_command(
TARGET libogg POST_BUILD
COMMAND cmake -E copy_if_different libogg/src/libogg/include/ogg/os_types.h include/ogg/os_types.h
)
add_custom_command(
TARGET libogg POST_BUILD
COMMAND cmake -E copy_if_different libogg/src/libogg/Win32/VS2010/win32/${CMAKE_BUILD_TYPE}/libogg_static.lib lib/libogg.lib
)
ExternalProject_Add(
libvorbis
# LIST_SEPARATOR ::
DEPENDS libogg
PREFIX libvorbis
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
URL_MD5 798a4211221073c1409f26eac4567e8b
#CONFIGURE_COMMAND rem nop
CONFIGURE_COMMAND echo msbuild win32/vs2010/libvorbis/libvorbis_static.vcxproj /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} "/p:IncludePath=""$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
BUILD_COMMAND msbuild win32/vs2010/libvorbis/libvorbis_static.vcxproj /t:Build /p:Configuration=${CMAKE_BUILD_TYPE} "/p:IncludePath=$(IncludePath)${CMAKE_INSTALL_PREFIX}/include/"
INSTALL_COMMAND rem nop
BUILD_IN_SOURCE 1
)
else()
if(APPLE)
set(CONFIG_ARGS "--build=x86_64")
endif()
ExternalProject_Add(
libogg
PREFIX libogg
URL http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
URL_MD5 0a7eb40b86ac050db3a789ab65fe21c2
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX} --disable-shared ${CONFIG_ARGS}
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
# due to limitation of cmake, the below line has no effect; it has to be executed before this script
set(ENV{PKG_CONFIG_PATH} "${CMAKE_INSTALL_PREFIX}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
ExternalProject_Add(
libvorbis
DEPENDS libogg
PREFIX libvorbis
URL http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
URL_MD5 798a4211221073c1409f26eac4567e8b
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX} --with-ogg=${CMAKE_INSTALL_PREFIX} --disable-shared ${CONFIG_ARGS}
BUILD_COMMAND make
INSTALL_COMMAND make install
BUILD_IN_SOURCE 1
)
endif()
More information about the CMake
mailing list