Issue
For example, in CmakeLists.txt
:
add_executable( ❤ test.cpp )
Will cause:
CMake Error at CMakeLists.txt:37 (add_executable):
The target name "❤" is reserved or not valid for certain CMake features,
such as generator expressions, and may result in undefined behavior.
I think useing non-ascii characters today is quite simple, how to make CMake support that?
Solution
Your options are limited with what you can use as target names, but you have much more flexibility with the OUTPUT_NAME
property.
Working example:
add_executable(heart test.cpp)
set_target_properties(heart PROPERTIES
OUTPUT_NAME ❤
)
Output:
$ make
[ 50%] Building CXX object CMakeFiles/heart.dir/test.cpp.o
[100%] Linking CXX executable ❤
[100%] Built target heart
Answered By - Stephen Newell