[CMake] Add sources to a target library after add_library()?
Loaden
loaden at gmail.com
Thu Sep 6 01:51:52 EDT 2012
Yes, it simply for GCC. But it is diffrent for MSVC compiler.
for MSVC, we have to use a .cpp file, e.g. stdafx.cpp to support
precompiled. (/Yc flags)
For now, I have to implement it like this to support both MSVC and GCC's
PCH support.
> set(target Core)
> if (QTCREATOR_PRECOMPILED AND MSVC)
> set(precompiled libpch.cpp)
> endif()
> set(sources
> lib.cpp
> lib2.cpp
> )
> add_qtcreator_plugin(${target}
> ${sources}
> ${precompiled}
> )
> add_dependencies(${target} Botan)
> if (QTCREATOR_PRECOMPILED)
> add_precompiled_header(${target} "CXX" libpch.h ${precompiled})
> use_precompiled_header(${target} "${sources}")
> endif()
>
2012/9/6 Mathias Gaunard <mathias.gaunard at ens-lyon.org>
> To use a precompiled header with GCC, just add -include
> path/to/precompiled/header.hpp to your compilation flags, and make sure
> you've built path/to/precompiled/header.**hpp.gch before that.
>
--
Best Regards
Yuchen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120906/bb9ade3c/attachment.htm>
More information about the CMake
mailing list