Perfect as ever. I just replaced the code by:

----------------------------------------------------------------------------------------------
PROJECT(test CXX)
ADD_EXECUTABLE(test test.cpp)
SET_TARGET_PROPERTIES(test PROPERTIES COMPILE_FLAGS "-fopenmp"
LINK_FLAGS "-fopenmp")
----------------------------------------------------------------------------------------------

and it works perfectly.

Thank you guys,
Caner Candan

On Fri, Mar 18, 2011 at 3:20 PM, Eric Noulard <eric.noul...@gmail.com> wrote:
> 2011/3/18 Caner Candan <ca...@candan.fr>:
>> Hi all,
>>
>> Since I have several targets to compile, I was looking for a way to
>> set some specific flags to one target among all others. In my example
>> I would like to set the openmp flag to the target test and I got an
>> error with the code below:
>>
>> ----------------------------------------------------------------------------------------------
>> PROJECT(test CXX)
>> ADD_EXECUTABLE(test test.cpp)
>> SET_TARGET_PROPERTIES(test PROPERTIES COMPILE_FLAGS "-fopenmp")
>> ----------------------------------------------------------------------------------------------
>>
>> Error:
>> ----------------------------------------------------------------------------------------------
>> [100%] Building CXX object CMakeFiles/test.dir/test.cpp.o
>> Linking CXX executable test
>> CMakeFiles/test.dir/test.cpp.o: In function `main':
>> test.cpp:(.text+0x29): undefined reference to `GOMP_parallel_start'
>> test.cpp:(.text+0x3a): undefined reference to `GOMP_parallel_end'
>> collect2: ld returned 1 exit status
>> make[2]: *** [test] Error 1
>> make[1]: *** [CMakeFiles/test.dir/all] Error 2
>
> Don't you need the same flags for linking?
> see the "LINK_FLAGS" property.
>
> --
> Erk
> Membre de l'April - « promouvoir et défendre le logiciel libre » -
> http://www.april.org
>
_______________________________________________
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