add_custom_command OUTPUT file not detected as part of the project

I'm using the add_custom_command to generate some source file

add_custom_command(
    OUTPUT ${GENERATED_FILE}
    COMMAND python somePythonScript.py)

and adding it to the executable

add_executable(${PROJECT_NAME} ${OTHER_SORUCES} ${GENERATED_FILE})
add_dependencies(${PROJECT_NAME} ${GENERATED_FILE}) 

The project is compiled ok, but CLion claims the ${GENERATED_FILE}doesn't belong to the project target.

Since the file doesn't exist before the compilation, it must be marked using the OUTPUT , otherwise, cmake add_executable fails on missing source file.

How can I fix it to let CLion detect this file?

Thanks,

Alon

0

请先登录再写评论。