Skip to content

Instantly share code, notes, and snippets.

@Manu343726
Last active August 4, 2020 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manu343726/7ef3579cdd465b06844e0d497d7b22a7 to your computer and use it in GitHub Desktop.
Save Manu343726/7ef3579cdd465b06844e0d497d7b22a7 to your computer and use it in GitHub Desktop.
Promote target to thirdparty
external_dependency(rttr https://github.com/rttrorg/rttr.git v0.9.6) 17 external_dependency(MetaStuff https://github.com/Manu343726/MetaStuff master) + 18 mark_as_external_target(rttr_core)
mark_as_external_target(rttr)
[47/112] Building CXX object examples/rttr-build/src/rttr/CMakeFiles/rttr_core.dir/destructor.cpp.o
FAILED: examples/rttr-build/src/rttr/CMakeFiles/rttr_core.dir/destructor.cpp.o
/usr/bin/clang++ -DRTTR_DLL -DRTTR_DLL_EXPORTS -Drttr_core_EXPORTS -Iexamples/rttr-build/src/rttr/.. -Iexamples/rttr-src/src/rttr/.. -frtt
i -O3 -DNDEBUG -frtti -g -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Werror -Wall -std=c++14 -MD -MT examples/rttr-build/src/r
ttr/CMakeFiles/rttr_core.dir/destructor.cpp.o -MF examples/rttr-build/src/rttr/CMakeFiles/rttr_core.dir/destructor.cpp.o.d -o examples/rttr
-build/src/rttr/CMakeFiles/rttr_core.dir/destructor.cpp.o -c examples/rttr-src/src/rttr/destructor.cpp
In file included from examples/rttr-src/src/rttr/destructor.cpp:29:
In file included from examples/rttr-src/src/rttr/../rttr/detail/destructor/destructor_wrapper_base.h:32:
In file included from examples/rttr-src/src/rttr/../rttr/type.h:1221:
In file included from examples/rttr-src/src/rttr/../rttr/detail/type/type_impl.h:36:
In file included from examples/rttr-src/src/rttr/../rttr/detail/type/get_create_variant_func.h:32:
In file included from examples/rttr-src/src/rttr/../rttr/variant.h:1156:
In file included from examples/rttr-src/src/rttr/../rttr/detail/variant/variant_impl.h:36:
In file included from examples/rttr-src/src/rttr/../rttr/detail/variant/variant_data_policy.h:36:
In file included from examples/rttr-src/src/rttr/../rttr/detail/variant/variant_data_converter.h:32:
examples/rttr-src/src/rttr/../rttr/detail/conversion/number_conversion.h:137:16: error: implicit conversion from 'int' to 'float' changes v
alue from 2147483647 to 2147483648 [-Werror,-Wimplicit-int-float-conversion]
if (from > std::numeric_limits<T>::max())
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function(mark_as_external_target TARGET) + 470 get_property(type TARGET ${TARGET} PROPERTY TYPE) + 471
if(NOT (type STREQUAL "INTERFACE_LIBRARY"))
get_property(includes TARGET ${TARGET} PROPERTY INCLUDE_DIRECTORIES) + 474 endif()
get_property(interface_includes TARGET ${TARGET} PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
set_property(TARGET ${TARGET} APPEND PROPERTY INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${includes} ${interface_includes})
endfunction()
@bruxisma
Copy link

bruxisma commented Aug 4, 2020

Try this instead. CMake should take care of it properly from here on out.

function(mark_as_external_target target)
  get_property(type TARGET ${target} PROPERTY TYPE)
  set(property INTERFACE_INCLUDE_DIRECTORIES)
  set(visibility PUBLIC)
  if (type STREQUAL "INTERFACE_LIBRARY")
    set(visibility INTERFACE)
  endif()
  get_property(includes TARGET ${target} PROPERTY ${property})
  target_include_directories(${target} ${visibility} SYSTEM ${includes})
  if (NOT (type STREQUAL "INTERFACE_LIBRARY"))
    get_property(includes TARGET ${target} PROPERTY INCLUDE_DIRECTORIES)
    target_include_directories(${target} PUBLIC SYSTEM ${includes})
  endif()
endfunction()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment