[CMake] How to check if a file is a source file?

Nils Gladitz nilsgladitz at gmail.com
Mon Aug 26 14:21:47 EDT 2013


Maybe CMAKE_<LANG>_SOURCE_FILE_EXTENSIONS would help with that.
For C++ this is e.g. CMAKE_CXX_SOURCE_FILE_EXTENSIONS set to 
"C;M;c++;cc;cpp;cxx;m;mm;CPP".

Nils

On 26.08.2013 19:10, Robert Dailey wrote:
> I have a common function defined that creates targets for me. I pass
> in a big list of source files. Within here are resource files (.RC),
> header files (.H) and source files (.CPP). However, I know that CPP
> files can take many extensions, so I want to create a thorough, safe
> check.
>
> Does CMake have a pre-built command or function to allow me to check a
> list of files for source files? I can write my own of course but I
> want to see if CMake has something first. Thanks.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list