[CMake] Compiling object files.

landa lantiat.damien at gmail.com
Wed Apr 3 10:26:59 EDT 2013


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.


More information about the CMake mailing list