MantisBT - CMake
View Issue Details
0012413CMakeCMakepublic2011-08-19 19:502012-02-06 06:07
Mikhail Titov 
Bill Hoffman 
normalminoralways
closedfixed 
Win32WindowsXP
CMake 2.8.5 
CMake 2.8.6CMake 2.8.6 
0012413: NMAKE generator: handling of target names with invalid nmake names (but valid otherwise) is missing
nmake expects target name made of characters, digits, and underscore.
When I have + in the name of the target (I'd like to build libxml++-2.34-vc90-d.dll), nmake fails to process build.make with the following error:

C:\workspace\gtkmm.build>nmake -f "libxml++-2.34.1\libxml++\CMakeFiles\libxml++-2.34.dir\build.make"

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.

libxml++-2.34.1\libxml++\CMakeFiles\libxml++-2.34.dir\build.make(1123) : fatal error U1001: syntax error : illegal character '+' in macro
Stop.

It would be nice if CMake somehow took care of "smart" nmake target name generation.
Here is the snippet from CMakeLists.txt

add_library(libxml++-${XMLMM_VERSION} SHARED ${XMLMM_SRCS} libxml++.def ../${EXTRA}/libxml++/libxml++.rc)
#set_target_properties(libxmlmm-${XMLMM_VERSION})

add_custom_command (OUTPUT libxml++.def
COMMAND ECHO Will be generated later > libxml++.def
)
add_custom_command(TARGET libxml++-${XMLMM_VERSION} PRE_LINK
COMMAND gendef ${CMAKE_CURRENT_BINARY_DIR}/libxml++.def libxml++-${XMLMM_VERSION}${POSTFIX}.dll ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libxml++-${XMLMM_VERSION}.dir/*.obj
)

target_link_libraries(libxml++-${XMLMM_VERSION} xml2.lib glibmm-${GLIBMM_VERSION} giomm-${GLIBMM_VERSION} sigc-${SIGC_VERSION})

install(TARGETS libxml++-${XMLMM_VERSION}
LIBRARY DESTINATION "lib"
ARCHIVE DESTINATION "lib"
RUNTIME DESTINATION "bin")

I ended up using OUTPUT_NAME property as a workaround:

set_target_properties(xmlpp-${XMLMM_VERSION} PROPERTIES OUTPUT_NAME xml++-${XMLMM_VERSION})
No tags attached.
Issue History
2011-08-19 19:50Mikhail TitovNew Issue
2011-08-24 16:14Bill HoffmanNote Added: 0027267
2011-08-24 16:14Bill HoffmanAssigned To => Bill Hoffman
2011-08-24 16:14Bill HoffmanStatusnew => assigned
2011-09-12 17:16David ColeStatusassigned => resolved
2011-09-12 17:16David ColeFixed in Version => CMake 2.8.6
2011-09-12 17:16David ColeResolutionopen => fixed
2011-09-12 17:16David ColeTarget Version => CMake 2.8.6
2012-02-06 06:07David ColeNote Added: 0028506
2012-02-06 06:07David ColeStatusresolved => closed

Notes
(0027267)
Bill Hoffman   
2011-08-24 16:14   
I have checked in a fix that should allow targets to have + in the name.

$ ssh git@cmake.org stage cmake merge -b next fix_nmake_var_plus
Fetching upstream next
Merge topic 'fix_nmake_var_plus' into next

281f51e Fix for bug 0012413, nmake did not handle targets with + in the name.

Pushing upstream next
To git@cmake.org:cmake.git

It is in the next branch of CMake git.
(0028506)
David Cole   
2012-02-06 06:07   
Closing resolved issues that have not been updated in more than 4 months.