diff options
author | Ben Boeckel <mathstuf@gmail.com> | 2015-02-04 11:39:06 -0500 |
---|---|---|
committer | Ben Boeckel <mathstuf@gmail.com> | 2015-02-07 20:51:06 -0500 |
commit | 91498e200292ef5f309fc0b7420f8a5bc8e308cc (patch) | |
tree | 90e00d8968364a95df999779fdde013631e77e97 | |
parent | 6f9408efe3bfe1fd8db54cb8537412d8bd95d969 (diff) | |
download | coreclr-91498e200292ef5f309fc0b7420f8a5bc8e308cc.tar.gz coreclr-91498e200292ef5f309fc0b7420f8a5bc8e308cc.tar.bz2 coreclr-91498e200292ef5f309fc0b7420f8a5bc8e308cc.zip |
Use foreach(IN LISTS) syntax in CMake code
It avoids extra separation on semicolons if there are any and skips a
variable expansion.
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/inc/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/vm/wks/CMakeLists.txt | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index ae7e9debf9..145b798130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ function(get_compile_definitions DefinitionName) # Get the current list of definitions get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS) - foreach(DEFINITION ${COMPILE_DEFINITIONS_LIST}) + foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST) if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$") # The entries that contain generator expressions must have the -D inside of the # expression. So we transform e.g. $<$<CONFIG:Debug>:_DEBUG> to $<$<CONFIG:Debug>:-D_DEBUG> @@ -38,7 +38,7 @@ endfunction(get_compile_definitions) # Build a list of include directories by putting -I in front of each include dir. function(get_include_directories IncludeDirectories) get_directory_property(dirs INCLUDE_DIRECTORIES) - foreach(dir ${dirs}) + foreach(dir IN LISTS dirs) set(INC_DIRECTORIES ${INC_DIRECTORIES} -I${dir}) endforeach() set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE) @@ -49,7 +49,7 @@ endfunction(get_include_directories) # The parameters after the RetSources are the input files. function(convert_to_absolute_path RetSources) set(Sources ${ARGN}) - foreach(Source ${Sources}) + foreach(Source IN LISTS Sources) set(AbsolutePathSources ${AbsolutePathSources} ${CMAKE_CURRENT_SOURCE_DIR}/${Source}) endforeach() set(${RetSources} ${AbsolutePathSources} PARENT_SCOPE) @@ -76,17 +76,17 @@ if (WIN32) # For multi-configuration toolset (as Visual Studio) # set the different configuration defines. # First DEBUG - foreach (Definition ${CLR_DEFINES_DEBUG_INIT}) + foreach (Definition IN LISTS CLR_DEFINES_DEBUG_INIT) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:DEBUG>:${Definition}>) endforeach (Definition) # Then RELEASE - foreach (Definition ${CLR_DEFINES_RELEASE_INIT}) + foreach (Definition IN LISTS CLR_DEFINES_RELEASE_INIT) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:RELEASE>:${Definition}>) endforeach (Definition) # And then RELWITHDEBINFO - foreach (Definition ${CLR_DEFINES_RELWITHDEBINFO_INIT}) + foreach (Definition IN LISTS CLR_DEFINES_RELWITHDEBINFO_INIT) set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$<CONFIG:RELWITHDEBINFO>:${Definition}>) endforeach (Definition) diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt index e8f52de6d1..d27a3b89c4 100644 --- a/src/inc/CMakeLists.txt +++ b/src/inc/CMakeLists.txt @@ -31,7 +31,7 @@ get_include_directories(MIDL_INCLUDE_DIRECTORIES) # Run custom midl command over each idl file FIND_PROGRAM( MIDL midl.exe ) -foreach(GENERATE_IDL ${CORGUIDS_IDL_SOURCES}) +foreach(GENERATE_IDL IN LISTS CORGUIDS_IDL_SOURCES) get_filename_component(IDLNAME ${GENERATE_IDL} NAME_WE) set(OUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}_i.c) set(CORGUIDS_SOURCES ${CORGUIDS_SOURCES} ${OUT_NAME}) @@ -50,7 +50,7 @@ add_compile_options(/TC) else() #The MIDL tool exists for Windows only, so for other systems, we have the prebuilt xxx_i.c files checked in -foreach(IDL_SOURCE ${CORGUIDS_IDL_SOURCES}) +foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES) get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE) set(C_SOURCE ../pal/prebuilt/idl/${IDLNAME}_i.c) set(CORGUIDS_SOURCES ${CORGUIDS_SOURCES} ${C_SOURCE}) diff --git a/src/vm/wks/CMakeLists.txt b/src/vm/wks/CMakeLists.txt index 2f7c16d69f..a0d2745f8b 100644 --- a/src/vm/wks/CMakeLists.txt +++ b/src/vm/wks/CMakeLists.txt @@ -9,7 +9,7 @@ get_directory_property(COMPILE_DEFINITIONS_LIST COMPILE_DEFINITIONS) # Extract the definitions for the ASM code. Since there is a bug in the cmake that prevents us from # using the generator expressions, we split the definitions into lists based on the configuration. -foreach(DEFINITION ${COMPILE_DEFINITIONS_LIST}) +foreach(DEFINITION IN LISTS COMPILE_DEFINITIONS_LIST) if (${DEFINITION} MATCHES "^\\$<\\$<CONFIG:([^>]+)>:([^>]+)>$") # The entry contains generator expression, so insert the definition into a definitions list # corresponding to the config @@ -23,7 +23,7 @@ endforeach() # Add defines for the ASM. Unfortunately setting it on the target is ignored for asm by the cmake, so we have # to set it on the sources. set_property(SOURCE ${VM_SOURCES_WKS_AMD64_ASM} PROPERTY COMPILE_DEFINITIONS ${ASM_DEFINITIONS}) -foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) +foreach(CONFIG IN LISTS CMAKE_CONFIGURATION_TYPES) string(TOUPPER ${CONFIG} CONFIG) set_property(SOURCE ${VM_SOURCES_WKS_AMD64_ASM} PROPERTY COMPILE_DEFINITIONS_${CONFIG} ${ASM_DEFINITIONS_${CONFIG}}) endforeach() |