On Wed, Mar 4, 2015 at 8:53 PM, Brad King <brad.k...@kitware.com> wrote:
> On 03/03/2015 07:43 AM, Adam Strzelecki wrote: > > On 03/01/2015 08:02 PM, Ben Boeckel wrote: > >> On 02/28/2015 11:59 AM, Adam Strzelecki wrote: > >> target_precompiled_header(<target> <path/to/precompiled_header.h>) > >> > >> target_precompiled_header(<target> <path/to/precompiled_header.h> > SHARED > >> > <other_target_to_share_precompiled_header_with>) > >> Could we rename this? Currently target_* functions are all related to > >> usage requirements and these are not usage requirements. > > > > Honestly I don't understand your request. What would be then the name > > that better represents what the function does. > > Currently the target_* commands are: > > target_compile_definitions > target_compile_features > target_compile_options > target_include_directories > target_link_libraries > target_sources > > They all have the general signature > > target_command(<target> [options] [<SCOPE> <items>...]...) > > where <SCOPE> is INTERFACE, PUBLIC, or PRIVATE and affects whether the > settings apply to sources in the target itself and/or its dependents. > The proposed target_precompiled_header signature does not fit into > this layout. Either a different command name is needed or one needs > to define the command signature and semantics to fit the above layout. > Do PCHs fit into usage requirements in any way? > That would be nice, right? I pushed some work to https://github.com/purpleKarrot/CMake/commits/pch Expect it to be incomplet and incorrekt. It certainly needs a couple of iterations, but the direction should be clear: add_library(foo foo.c) target_include_directories(foo PUBLIC include) target_precompile_headers(foo PUBLIC foo.h) add_library(bar INTERFACE) target_include_directories(bar INTERFACE include) target_precompile_headers(bar INTERFACE bar.h) add_executable(foobar foobar.c) target_link_libraries(foobar foo bar) There is a new command called "target_precompile_headers". This name is chosen carefully. * It says "precompile headers", not "precompiled header". This command is used to set a list of headers "to precompile". It is not used to specify a single prebuilt file. * It has a "target_" prefix, and the expectations about usage requirements should be satisfied. Things to keep in mind: * We probably want to precompile headers based on configuration. * For generators that support it (Makefile + Ninja), we want to precompile headers based on the compile language. * We probably want to enable/disable the use of PCH globally, on a per-target-level, and on a per-source-level. > In meantime https://github.com/nanoant/CMakePCHCompiler is just an implementation that "emulates" desired behavior using many tricks. But I don't want this to be a part of CMake, but instead I want this to be handled natively adding some extra variables: Good. That means we are on the same page. I was a little confused when I first saw your approach. :-) cheers, Daniel
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers