[PATCH] [CMake] Update required version to 2.8.12 to improve build time with target_link_libraries(INTERFACE)
Brad King
brad.king at kitware.com
Mon Feb 24 05:31:37 PST 2014
On 02/23/2014 08:14 PM, NAKAMURA Takumi wrote:
>
> Argyrios, I'd be happy if this feature worked as optional.
>
> Brad, any good idea?
> Could I twiddle cmake_minimum_required and cmake_policy explicitly there?
You can leave
cmake_minimum_required(VERSION 2.8.8)
alone and make the new keyword arguments conditional with variables:
if(NOT CMAKE_VERSION VERSION_LESS 2.8.12)
set(cmake_2_8_12_INTERFACE INTERFACE)
set(cmake_2_8_12_PRIVATE PRIVATE)
else()
set(cmake_2_8_12_INTERFACE)
set(cmake_2_8_12_PRIVATE)
endif()
Then use them like this:
target_link_libraries(${name} ${cmake_2_8_12_INTERFACE} ${ARG_LINK_LIBS})
On older versions the call will turn into
target_link_libraries(${name} ${ARG_LINK_LIBS})
and on 2.8.12 and above it will become
target_link_libraries(${name} INTERFACE ${ARG_LINK_LIBS})
The "cmake_2_8_12_" prefix is just to call attention to the code
to remember to simplify it when 2.8.12 or later becomes required.
Any variable names could be used, of course.
-Brad
More information about the llvm-commits
mailing list