Please add configure time expandable expressions
Generator expressions allow to greatly simplify conditional statements, but obviously work at the generation phase. The lack of return values in the CMake language result in prolix code, unneeded temporal variables, etc. Could you, please, consider adding "configuration expressions", similar to the generator ones? They might look in the very same way like the generator expressions but use another type of braces (e.g. $[]). Unlike a generator expression, a "configuration expression" is expanded as soon as encountered. A few examples follow.
add_library(theLib $[IF:BUILD_PLUGINS,MODULE,STATIC])
target_sources(aTarget $[TRANSFORM:${srcs},PREPEND,src/) # add source files from the "src" subdir
if(${PackageName}_FOUND OR $[TOUPPER:${PackageName}]_FOUND)
target_link_libraries(aTarget PRIVATE $[$[BOOL:WIN32]:wsock32 ws2_32 Iphlpapi] $[$[BOOL:ANDROID]:${CMAKE_DL_LIBS}] )
target_compile_options(aTarget PRIVATE $[IF:CMAKE_COMPILER_ID MATCHES Clang:-Weverything,] $[IF:CMAKE_COMPILER_ID MATCHES GNU:-Wall,] $[IF:CMAKE_COMPILER_ID MATCHES MSVC:/W4,] )
And a bit from the dark side:
$[EVAL:variableName,list(JOIN ${aList} "blah-blah" variableName)]
expands to ${variableName}
after evaluating the given expression in the current context