Singly-quote target names for Watcom linker

The Watcom tools do their own command-line parsing and do not accept
double-quotes.  Instead we single-quote the target output name when
invoking wlink and other Watcom tools.  This fixes support for spaces in
the target output directory path when it is not under the build tree.
This commit is contained in:
Brad King 2009-11-30 11:16:24 -05:00
parent 5152bf5639
commit 4f43c1f276
2 changed files with 14 additions and 4 deletions

View File

@ -27,11 +27,11 @@ SET (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib l
SET (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
SET(CMAKE_C_CREATE_IMPORT_LIBRARY
"wlib -q -n -b <TARGET_IMPLIB> +<TARGET>")
"wlib -q -n -b <TARGET_IMPLIB> +'<TARGET_UNQUOTED>'")
SET(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
SET(CMAKE_C_LINK_EXECUTABLE
"wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
"wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
@ -52,7 +52,7 @@ SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_CREATE_SHARED_MODULE
"wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name <TARGET> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
"wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
${CMAKE_CXX_CREATE_SHARED_MODULE}
${CMAKE_CXX_CREATE_IMPORT_LIBRARY})
@ -64,7 +64,7 @@ SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY})
SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_MODULE})
# create a C++ static library
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b <TARGET> <OBJECTS> ")
SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b '<TARGET_UNQUOTED>' <OBJECTS> ")
# create a C static library
SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY})

View File

@ -911,6 +911,16 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
return targetQuoted;
}
if(variable == "TARGET_UNQUOTED")
{
std::string unquoted = replaceValues.Target;
std::string::size_type sz = unquoted.size();
if(sz > 2 && unquoted[0] == '\"' && unquoted[sz-1] == '\"')
{
unquoted = unquoted.substr(1, sz-2);
}
return unquoted;
}
if(replaceValues.LanguageCompileFlags)
{
if(variable == "LANGUAGE_COMPILE_FLAGS")