[CMake] Setting environment variables in custom command

Robert Dailey rcdailey at gmail.com
Mon Dec 12 14:28:29 EST 2011


Hi,

I'm creating a custom target in CMake 2.8.7 RC1 and running it in Visual
Studio 2008. I set an environment variable called BUILDBIN in the custom
command but for some reason my scripts that I invoke are not picking up
that environment variable. Am I doing something wrong? These custom
commands are starting to get pretty complex and I'm wondering if I should
pull out the logic into a batch file. What do you guys think?

set( server "${CMAKE_SOURCE_DIR}/${DIRECTORY_SERVER}" )
set( common "${CMAKE_SOURCE_DIR}/common" )
set( symlinks "${SYMLINK_DIR}" )
set( tess "${CMAKE_CURRENT_SOURCE_DIR}/TessInstall" )

foreach( incdir ${INSTALLSHIELD_INCLUDE_DIRS} )
list( APPEND include_dirs "-i${incdir}" )
endforeach()

set( command_compile
"${INSTALLSHIELD_COMPILER}"
"${tess}/Script Files/setup.rul"
${INSTALLSHIELD_LIBRARIES}
"-i${tess}/Script Files"
${include_dirs}
"-i${server}/gmmserver/installer"
"-i${common}/exchange/gdexchsrvcommon"
"-i${symlinks}/gtgisde"
"-dBUILDBIN=${BUILD_DIRECTORY}/$<CONFIGURATION>"
)

set( command_env
COMMAND "set" "BUILDBIN=\"${BUILD_DIRECTORY}/$<CONFIGURATION>\""
)

set( command_isbuild
"${INSTALLSHIELD_ISBUILD}"
"-p\"${tess}/tess install.ipr\""
"-m\"CD\""
)

add_custom_target( domino_installer
COMMAND ${command_compile}
${command_env}
COMMAND ${command_isbuild}
DEPENDS gtgisde
COMMENT "Building GMM Domino Installer through Install Shield..." #VERBATIM
)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111212/30da4f70/attachment.htm>


More information about the CMake mailing list