Hi Marco.

Sane compilers allow later command-line options to override earlier ones,
so what you're doing should be fine. Unfortunately, I know some Fortran
compilers are not sane in this regard.

If you really need to solve this by explicitly modifying the global list
for a particular file, the only thing I can think of is move those files to
a separate CMakeList and turn them into an object library:

# In normal CMakeList:

add_subdirectory(special_file_dir)

add_executable(YourNormalTarget normal_file1.f90 normal_file2.f90
$<TARGET_OBJECTS:special_files>)


# In special_file_dir/CMakeLists.txt:

set(CMAKE_Fortran_FLAGS "-only -flags -you -want")

add_library(special_files OBJECT special_fil1.f90 special_file2.f90)


I haven't tested it, but it should work.

Petr


On Tue, Aug 5, 2014 at 4:29 PM, marco restelli <mreste...@gmail.com> wrote:

> Hi,
>    I would like to reset CMAKE_Fortran_FLAGS for one specific file in
> a project. I have tried
>
> SET_SOURCE_FILES_PROPERTIES(my_file.f90 PROPERTIES COMPILE_FLAGS "-O0 -g")
>
> but it appends the new flags keeping the old ones. How can reset these
> flags? Specifically, I have some files for which I need to avoid any
> error checking and any optimization, independently from the selected
> compiler.
>
> Thanks, regards,
>    Marco
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake
>
-- 

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://public.kitware.com/mailman/listinfo/cmake

Reply via email to