[CMake] issue with target_link_libraries and MSVC

Benjamin Ballet bballet at ivsweb.com
Wed Apr 13 05:28:12 EDT 2016


Ho yes, my bad, however there is still the same issue with forward slashes

I receive the flag with FindOpenMP module. It's sad we can't do :
target_link_libraries(... ${OpenMP_CXX_FLAGS}) for a few target

In the end I add the flags for the whole project :
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")

2016-04-13 7:54 GMT+02:00 Matějů Miroslav, Ing. <Mateju.Miroslav at azd.cz>:

> Hi Benjamin,
>
>
>
> MSVC flags start with “forward” slashes: / (However, MSVC also accepts
> hyphens (-) in my experience.)
>
> Documentation for /openmp flag:
> https://msdn.microsoft.com/library/fw509c3b.aspx
>
>
>
> Best regards,
>
> Miroslav
>
>
>
> *From:* CMake [mailto:cmake-bounces at cmake.org] *On Behalf Of *Benjamin
> Ballet via CMake
> *Sent:* Tuesday, April 12, 2016 5:30 PM
> *To:* cmake at cmake.org
> *Subject:* [CMake] issue with target_link_libraries and MSVC
>
>
>
> I'm trying to add the openmp flag to a target with target_link_libraries.
>
> \openmp is interpreted as a file name and visual try to link to \openmp.obj
>
>
>
> The documentation state that target_link_libraries see an item as a flag
> if it start with - but MSVC flags start with \
>
>
>
> Is there a way to add a link flags to a target with target_link_libraries
> and MSVC ?
>
>
>
> Thank you all
>
>
>
> --
>
> *Benjamin BALLET*
> Ingénieur R&D
>
>
> *ACTIVISU*
>
> 19, rue Klock - 92110 Clichy
>
> *> Standard Tél* :  01 44 69 37 37
>
> *>* www.activisu.com
>



-- 
*Benjamin BALLET*
Ingénieur R&D

*ACTIVISU*
19, rue Klock - 92110 Clichy
*> Standard Tél* :  01 44 69 37 37
*>* www.activisu.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160413/5551cbfd/attachment-0001.html>


More information about the CMake mailing list