[Cmake-commits] [cmake-commits] king committed CMakeLists.txt 1.10 1.11 preprocess.c 1.2 1.3 preprocess.cxx 1.2 1.3
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Mar 23 14:48:11 EDT 2009
Update of /cvsroot/CMake/CMake/Tests/Preprocess
In directory public:/mounts/ram/cvs-serv6144/Tests/Preprocess
Modified Files:
CMakeLists.txt preprocess.c preprocess.cxx
Log Message:
ENH: Support preprocessor def values in VS6
The add_definitions() command and COMPILE_DEFINITIONS dir/tgt/src
properties support preprocessor definitions with values. Previously
values were not supported in the VS6 generator even though the native
tool supports them. It is only values with spaces that VS6 does not
support. This enables support and instead complains only for values
with spaces. See issue #8779.
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Preprocess/CMakeLists.txt,v
retrieving revision 1.10
retrieving revision 1.11
diff -C 2 -d -r1.10 -r1.11
*** CMakeLists.txt 20 Mar 2008 22:25:33 -0000 1.10
--- CMakeLists.txt 23 Mar 2009 18:48:09 -0000 1.11
***************
*** 66,77 ****
endif(NOT BORLAND AND NOT PP_VS70)
! if(NOT PP_BORLAND AND NOT PP_WATCOM)
! # Borland, WMake: multiple spaces
! # The make tool seems to remove extra whitespace from inside
! # quoted strings when passing to the compiler. It does not have
! # trouble passing to other tools, and the compiler may be directly
! # invoked from the command line.
! set(STRING_EXTRA "${STRING_EXTRA} ")
! endif(NOT PP_BORLAND AND NOT PP_WATCOM)
if(NOT PP_VS)
--- 66,83 ----
endif(NOT BORLAND AND NOT PP_VS70)
! if(NOT PP_VS6)
! # VS 6 IDE: spaces
! # The project parser unconditionally separates arguments at spaces.
! set(STRING_EXTRA "${STRING_EXTRA} ")
!
! if(NOT PP_BORLAND AND NOT PP_WATCOM)
! # Borland, WMake: multiple spaces
! # The make tool seems to remove extra whitespace from inside
! # quoted strings when passing to the compiler. It does not have
! # trouble passing to other tools, and the compiler may be directly
! # invoked from the command line.
! set(STRING_EXTRA "${STRING_EXTRA} ")
! endif(NOT PP_BORLAND AND NOT PP_WATCOM)
! endif(NOT PP_VS6)
if(NOT PP_VS)
***************
*** 153,157 ****
# Compose the final test string.
! set(STRING_VALUE "hello `~!@$*)(_+-=}{][:'.?/ ${STRING_EXTRA}world")
#-----------------------------------------------------------------------------
--- 159,163 ----
# Compose the final test string.
! set(STRING_VALUE "hello`~!@$*)(_+-=}{][:'.?/${STRING_EXTRA}world")
#-----------------------------------------------------------------------------
***************
*** 195,203 ****
# Make sure old-style definitions are converted to directory property.
! if(PREPROCESS_VS6)
! set(OLD_DEFS_EXPECTED "OLD_DEF")
! else(PREPROCESS_VS6)
! set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2")
! endif(PREPROCESS_VS6)
get_property(OLD_DEFS DIRECTORY PROPERTY COMPILE_DEFINITIONS)
if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}")
--- 201,205 ----
# Make sure old-style definitions are converted to directory property.
! set(OLD_DEFS_EXPECTED "OLD_DEF;OLD_EXPR=2")
get_property(OLD_DEFS DIRECTORY PROPERTY COMPILE_DEFINITIONS)
if(NOT "${OLD_DEFS}" STREQUAL "${OLD_DEFS_EXPECTED}")
***************
*** 226,246 ****
endforeach(c)
! # Add definitions with values. VS6 does not support this.
if(NOT PREPROCESS_VS6)
! set_property(
! TARGET Preprocess
! APPEND PROPERTY COMPILE_DEFINITIONS
! "TARGET_STRING=\"${STRING_VALUE}${SEMICOLON}\""
! "TARGET_EXPR=${EXPR}"
! "TARGET_PATH=\"${TARGET_PATH}\""
! )
! set_property(
! SOURCE preprocess.c preprocess${VS6}.cxx
! APPEND PROPERTY COMPILE_DEFINITIONS
! "FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\""
! "FILE_EXPR=${EXPR}"
! "FILE_PATH=\"${FILE_PATH}\""
! )
endif(NOT PREPROCESS_VS6)
# Helper target for running test manually in build tree.
--- 228,251 ----
endforeach(c)
! # Add definitions with values.
if(NOT PREPROCESS_VS6)
! # The path might have spaces, which VS6 does not support.
! set(DEF_TARGET_PATH "TARGET_PATH=\"${TARGET_PATH}\"")
! set(DEF_FILE_PATH "FILE_PATH=\"${FILE_PATH}\"")
endif(NOT PREPROCESS_VS6)
+ set_property(
+ TARGET Preprocess
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ "TARGET_STRING=\"${STRING_VALUE}${SEMICOLON}\""
+ "TARGET_EXPR=${EXPR}"
+ ${DEF_TARGET_PATH}
+ )
+ set_property(
+ SOURCE preprocess.c preprocess${VS6}.cxx
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ "FILE_STRING=\"${STRING_VALUE}${SEMICOLON}\""
+ "FILE_EXPR=${EXPR}"
+ ${DEF_FILE_PATH}
+ )
# Helper target for running test manually in build tree.
Index: preprocess.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Preprocess/preprocess.cxx,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** preprocess.cxx 18 Jan 2008 00:29:43 -0000 1.2
--- preprocess.cxx 23 Mar 2009 18:48:09 -0000 1.3
***************
*** 12,16 ****
{
int result = 1;
- #ifndef PREPROCESS_VS6
if(strcmp(FILE_STRING, STRING_VALUE) != 0)
{
--- 12,15 ----
***************
*** 41,45 ****
}
}
- #endif
#ifdef NDEBUG
# ifdef FILE_DEF_DEBUG
--- 40,43 ----
Index: preprocess.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/Preprocess/preprocess.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** preprocess.c 18 Jan 2008 00:29:43 -0000 1.2
--- preprocess.c 23 Mar 2009 18:48:09 -0000 1.3
***************
*** 10,14 ****
{
int result = 1;
- #ifndef PREPROCESS_VS6
if(strcmp(FILE_STRING, STRING_VALUE) != 0)
{
--- 10,13 ----
***************
*** 39,43 ****
}
}
- #endif
#ifdef NDEBUG
# ifdef FILE_DEF_DEBUG
--- 38,41 ----
More information about the Cmake-commits
mailing list