Hello Daniel,

I'm also starting with CMake and I had a problem to link an object to my
project. I will describe you what I did because it works for me but keep in
mind that maybe there is a better way.

First, you can compile object files with the command "execute_process":

         execute_process(
                   COMMAND
                   $(FC) $(FFLAGS) $(FFLAGS_GENERAL) $(F90FLAGS) -o
cparam.lib -c cparam.f90
                   )

Note that it is not "cparam.o" but "cparam.lib".

Then you can link it to your project as a library with the command
"target_link_libraries":

         target_link_libraries(
                    your_project
                    cparam.lib
                    )

Hope it can help you.
Damien



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/Compiling-object-files-tp7583910p7583911.html
Sent from the CMake mailing list archive at Nabble.com.
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to