LANGUAGE property is not set for source files added with target_sources
When adding a source file via the target_sources
function, the LANGUAGE
property is not set on the source file.
Incidentally, obtaining the LOCATION
property from the source file first seems to result in the LANGUAGE
property being correctly set.
Simple reproduction case:
project(test_project)
add_executable(test_exe)
target_sources(test_exe PRIVATE main.c)
# Uncomment this line to make the "LANGUAGE" work
# get_source_file_property(_loc main.c LOCATION)
get_source_file_property(_lang main.c LANGUAGE)
message("Language: ${_lang}") # Set to "NOTFOUND"
It also works if the source file is added using add_executable(test_exe main.c)