Hi Alex,

On Mittwoch, 15. März 2017 22:40:16 CET Alexander Neundorf wrote:
> Hi,
> 
> I'm building hpx without cuda, and in examples/qt/, tools/ and
> tools/inspect/ cmake errors out with the following error:
> 

This is embarrassing, please see inline for more discussion

> CMake Error at examples/qt/CMakeLists.txt:26 (target_link_libraries):
>   Policy CMP0023 is not set: Plain and keyword target_link_libraries
>   signatures cannot be mixed.  Run "cmake --help-policy CMP0023" for policy
>   details.  Use the cmake_policy command to set the policy and suppress this
> warning.
> 
>   The keyword signature for target_link_libraries has already been used with
> the target "qt_exe".  All uses of target_link_libraries with a target must
> be either all-keyword or all-plain.
> 
>   The uses of the keyword signature are here:
> 
>    * cmake/HPX_SetupTarget.cmake:202 (target_link_libraries)
> 
> 
> This happens AFAICT because in HPX_SetupTarget.cmake there is the following
> code:
> if(NOT HPX_WITH_CUDA)  # Cuda needs plain target_link_libraries() signature
>   target_link_libraries(${target} PUBLIC ${hpx_libs} ${target_DEPENDENCIES})
> else()
>   target_link_libraries(${target} ${hpx_libs} ${target_DEPENDENCIES})
> endif()
> 
> i.e. without CUDA the "PUBLIC" signature of target_link_libraries() is used.
> Now in the mentioned directories target_link_libraries() is used without
> PUBLIC/PRIVATE/INTERFACE keywords.
> This is (by default) not allowed (see here
> https://cmake.org/cmake/help/v3.8/ policy/CMP0023.html ).
> 
> I could make it work for me by adding "PRIVATE" (or "PUBLIC") to the
> respective target_link_libraries() calls, e.g. in examples/qt/.
> But I guess this will break then in the other case, when building with CUDA.
> 
> The "PUBLIC" was added last November without much explanation:
> https://github.com/STEllAR-GROUP/hpx/commit/
> fb1fc68ea82a4623b5644f15f1d508fa9733f442

The commit introducing it was part of this PR:
https://github.com/STEllAR-GROUP/hpx/pull/2392

> 
> In src/CMakeLists.txt this is handled by duplicating the whole
> target_link_libraries()-calls in an if(WITH_CUDA) branch.
> 
> I see the following options to make it always work:
> 
> 1. add something like hpx_target_link_libraries(), which wraps
> target_link_libraries() and contains this if(WITH_CUDA) - maybe a bit
> overkill ?

Yes, I don't like it ... in the end, I would our cmake build system to work 
without too much hpx_XXX calls. hpx_setup_target is currently the only 
required call. hpx_add_executable and friends is essentially a convenience 
wrapper for add_executable (and friends) and hpx_setup_target.

> 
> 2. set a HPX_TLL_KEYWORD variable at the top level and use that then
> everywhere in the target_link_libraries() calls:
> set( HPX_TLL_KEYWORD)
> if (NOT HPX_WITH_CUDA)
>   set(HPX_TLL_KEYWORD PUBLIC)
> endif()

Sounds sensible to me...

> 
> 3. add the if(WITH_CUDA) in the three CMakeLists.txt which have a problem
> right now.

This is something we could do as well, as soon as third party applications run 
into that problem, we are back to square one.

> 
> 4. remove the "PUBLIC" from hpx_setup_target().
> But I guess there was a reason why it was added ?

Yes, see the PR I linked above

> 
> 5. add PUBLIC also with CUDA, but I guess there is a reason it is not there
> ?

Yes, the CUDA cmake wrappers are a PITA and use the plain signature.

> 
> I think my favourite is option 2, add a keyword-variable.

Yes, this could also be documented nicely.
What about explicitly setting CMP0023?

> 
> Alex
> 
> _______________________________________________
> hpx-users mailing list
> [email protected]
> https://mail.cct.lsu.edu/mailman/listinfo/hpx-users


_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to