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

Made 'include_directories' use correct boost include var. #50

Merged
merged 1 commit into from
Oct 30, 2015

Conversation

camio
Copy link
Contributor

@camio camio commented Apr 3, 2014

The documentation of FindBoost (cmake --help-module FindBoost)
indicates that 'Boost_INCLUDE_DIRS' points to the boost includes and not
'Boost_INCLUDE_DIR'.

This bug could inadvertently cause pion to use system boost headers with
another boost installation's libraries.

The documentation of FindBoost (cmake --help-module FindBoost)
indicates that 'Boost_INCLUDE_DIRS' points to the boost includes and not
'Boost_INCLUDE_DIR'.

This bug could inadvertently cause pion to use system boost headers with
another boost installation's libraries.
@snikulov
Copy link
Contributor

snikulov commented Apr 3, 2014

@camio could you please provide more information about this issue?

In fact with my cmake v2.8.12.2

FindBoost.cmake contains following code

...
# ------------------------------------------------------------------------
#  End finding boost libraries
# ------------------------------------------------------------------------
set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})

Which makes Boost_INCLUDE_DIRS equivalent to Boost_INCLUDE_DIR

@camio
Copy link
Contributor Author

camio commented Apr 3, 2014

@snikulov The documentation for FindBoost as given by 'cmake --help-module FindBoost', reproduced below, explicitly discourages the use of 'Boost_INCLUDE_DIR' in favor of 'Boost_INCLUDE_DIRS'. "Projects should not read these entries directly but instead use the above result variables."

We're using a custom FindBoost that maintains interface compatibility with cmake's one and that is where we came across this problem.

cmake version 2.8.12.2
  FindBoost
       Find Boost include dirs and libraries

       Use this module by invoking find_package with the form:

         find_package(Boost
           [version] [EXACT]      # Minimum or EXACT version e.g. 1.36.0
           [REQUIRED]             # Fail with error if Boost is not found
           [COMPONENTS <libs>...] # Boost libraries by their canonical name
           )                      # e.g. "date_time" for "libboost_date_time"

       This module finds headers and requested component libraries OR a CMake
       package configuration file provided by a "Boost CMake" build.  For the
       latter case skip to the "Boost CMake" section below.  For the former
       case results are reported in variables:

         Boost_FOUND            - True if headers and requested libraries were found
         Boost_INCLUDE_DIRS     - Boost include directories
         Boost_LIBRARY_DIRS     - Link directories for Boost libraries
         Boost_LIBRARIES        - Boost component libraries to be linked
         Boost_<C>_FOUND        - True if component <C> was found (<C> is upper-case)
         Boost_<C>_LIBRARY      - Libraries to link for component <C> (may include
                                  target_link_libraries debug/optimized keywords)
         Boost_VERSION          - BOOST_VERSION value from boost/version.hpp
         Boost_LIB_VERSION      - Version string appended to library filenames
         Boost_MAJOR_VERSION    - Boost major version number (X in X.y.z)
         Boost_MINOR_VERSION    - Boost minor version number (Y in x.Y.z)
         Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
         Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
                                - Pass to add_definitions() to have diagnostic
                                  information about Boost's automatic linking
                                  displayed during compilation



       This module reads hints about search locations from variables:

         BOOST_ROOT             - Preferred installation prefix
          (or BOOSTROOT)
         BOOST_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
         BOOST_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
         Boost_NO_SYSTEM_PATHS  - Set to ON to disable searching in locations not
                                  specified by these hint variables. Default is OFF.
         Boost_ADDITIONAL_VERSIONS
                                - List of Boost versions not known to this module
                                  (Boost install locations may contain the version)

       and saves search results persistently in CMake cache entries:

         Boost_INCLUDE_DIR         - Directory containing Boost headers
         Boost_LIBRARY_DIR         - Directory containing Boost libraries
         Boost_<C>_LIBRARY_DEBUG   - Component <C> library debug variant
         Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant

       Users may set these hints or results as cache entries.  Projects
       should not read these entries directly but instead use the above
       result variables.  Note that some hint names start in upper-case
       "BOOST".  One may specify these as environment variables if they are
       not specified as CMake variables or cache entries.

@snikulov
Copy link
Contributor

snikulov commented Apr 3, 2014

@camio thank you, I'm able to read documentation myself.
Could you please explain use case where failure can be exposed?
The only one which is come to my mind - update BOOSTROOT environment variable and regenerate project without deleting the CmakeCache .
Is it this case?

@camio
Copy link
Contributor Author

camio commented Apr 3, 2014

@snikulov The use we ran into is exactly what I mentioned in the previous comment. A custom FindBoost.cmake command that is interface compatible with the one that comes with the system cmake. Rather than modify our custom 'FindBoost.cmake' command to support this invalid use of find_package(Boost...), it seems better to fix the pion cmake code.

What you mentioned may also demonstrate the problem. I haven't tested it.

@snikulov
Copy link
Contributor

snikulov commented Apr 3, 2014

@camio Ok. Thank you.

@mikedickey mikedickey merged commit fca3388 into splunk:develop Oct 30, 2015
firedaemon-cto pushed a commit to FireDaemon/pion that referenced this pull request Aug 27, 2020
Silence MSVC warnings about integer truncation
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.

3 participants