Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark PROTOBUF_INCLUDE_DIRS as BUILD_INTERFACE #1466

Merged
merged 4 commits into from
Nov 19, 2018

Conversation

okapies
Copy link
Contributor

@okapies okapies commented Oct 2, 2018

It fixes a failure when running cmake command if:

  1. onnx project is included in other CMake project as a subdirectory and put its outputs to build directory
add_subdirectory(${CMAKE_SOURCE_DIR}/external/onnx
include_directories("${ONNX_INCLUDE_DIRS}")

and

  1. protobuf binary is also put in the build directory

because PROTOBUF_INCLUDE_DIRS is not marked as BUILD_INTERFACE in target_include_directories.

$ cmake ..
-- CMAKE_BUILD_TYPE is unset, defaulting to Release
-- Build type: Release
-- Adding external/onnx
-- Adding external/onnx
-- 
-- ******** Summary ********
--   CMake version         : 3.5.1
--   CMake command         : /usr/bin/cmake
--   System                : Linux
--   C++ compiler          : /usr/bin/c++
--   C++ compiler version  : 5.5.0
--   CXX flags             : 
--   Build type            : Release
--   CMAKE_PREFIX_PATH     : 
--   CMAKE_INSTALL_PREFIX  : /usr/local
--   CMAKE_MODULE_PATH     : /home/okapies/myproject/cmake
-- 
--   ONNX version          : 1.2.2
--   ONNX NAMESPACE        : onnx
--   ONNX_BUILD_TESTS      : OFF
--   ONNX_BUILD_BENCHMARKS : OFF
--   ONNX_USE_LITE_PROTO   : OFF
-- 
--   Protobuf compiler     : /home/okapies/myproject/build/protobuf-3.6.1/bin/protoc
--   Protobuf includes     : /home/okapies/myproject/build/protobuf-3.6.1/include
--   Protobuf libraries    : /home/okapies/myproject/build/protobuf-3.6.1/lib/libprotobuf.a
--   BUILD_ONNX_PYTHON     : OFF
-- Adding test

...

-- Adding include
-- Configuring done
CMake Error in external/onnx/CMakeLists.txt:
  Target "onnx_proto" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/home/okapies/myproject/build/protobuf-3.6.1/include"

  which is prefixed in the build directory.


CMake Error in external/onnx/CMakeLists.txt:
  Target "onnx_proto" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/home/okapies/myproject/build/protobuf-3.6.1/include"

  which is prefixed in the build directory.Target "onnx_proto"
  INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/home/okapies/myproject/build/protobuf-3.6.1/include"

  which is prefixed in the source directory.

@CLAassistant
Copy link

CLAassistant commented Oct 2, 2018

CLA assistant check
All committers have signed the CLA.

@zrphercule zrphercule self-requested a review October 9, 2018 18:55
Copy link
Member

@zrphercule zrphercule left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okapies Hi! Thanks for you contribution!
Would you mind sign the CLA first?

@okapies
Copy link
Contributor Author

okapies commented Oct 11, 2018

I'm sorry for my late response. I signed your CLA. Could you please check it? Thanks. @zrphercule

Copy link
Member

@houseroad houseroad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@houseroad houseroad closed this Nov 19, 2018
@houseroad houseroad reopened this Nov 19, 2018
@houseroad houseroad merged commit d09d139 into onnx:master Nov 19, 2018
@okapies okapies deleted the feature/protobuf-include-dirs branch November 20, 2018 03:03
hariharans29 pushed a commit to hariharans29/onnx that referenced this pull request Aug 15, 2019
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants