Issue
I am trying to compile an example of CGAL on Windows with VS2019. An error occurred during the compilation process: Could NOT find Boost: missing: program_options (found F:/boost_1_81_0/boostmake/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0")) NOTICE: This project requires Boost Program Options and will not be compiled. How can I solve this problem? Thank you and have a nice day.
This is its Cmakefile:
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.23)
project(Ridges_3_Examples)
find_package(CGAL REQUIRED)
find_package(Eigen3 3.1.0 QUIET) #(requires 3.1.0 or greater)
include(CGAL_Eigen3_support)
if(TARGET CGAL::Eigen3_support)
# Link with Boost.ProgramOptions (optional)
find_package(Boost COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
create_single_source_cgal_program(Compute_Ridges_Umbilics.cpp)
target_link_libraries(Compute_Ridges_Umbilics PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program(Ridges_Umbilics_SM.cpp)
target_link_libraries(Ridges_Umbilics_SM PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program(Ridges_Umbilics_LCC.cpp)
target_link_libraries(Ridges_Umbilics_LCC PUBLIC CGAL::Eigen3_support)
add_definitions("-DCGAL_USE_BOOST_PROGRAM_OPTIONS")
if(TARGET Boost::program_options)
target_link_libraries(Compute_Ridges_Umbilics PRIVATE Boost::program_options)
target_link_libraries(Ridges_Umbilics_SM PRIVATE Boost::program_options)
target_link_libraries(Ridges_Umbilics_LCC PRIVATE Boost::program_options)
else()
target_link_libraries(Compute_Ridges_Umbilics PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(Ridges_Umbilics_SM PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_link_libraries(Ridges_Umbilics_LCC PRIVATE ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif()
else()
message("NOTICE: This project requires Boost Program Options and will not be compiled.")
endif()
else()
message("NOTICE: This project requires Eigen 3.1 (or greater), and will not be compiled.")
endif()
I use set(Boost_DEBUG ON), but I can't find the problem, everything looks right. This is output:
Selecting Windows SDK version 10.0.16299.0 to target Windows 10.0.22000.
The C compiler identification is MSVC 19.29.30145.0
The CXX compiler identification is MSVC 19.29.30145.0
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Visual Leak Detector (VLD) is not found.
Using header-only CGAL
Targetting Visual Studio 16 2019
Target build environment supports auto-linking
Using VC toolset 142.
Generator uses intermediate configuration directory: $(Configuration)
Found GMP: debug;F:/CGAL-5.5.1/auxiliary/gmp/lib/libgmp-10.lib;optimized;F:/CGAL-5.5.1/auxiliary/gmp/lib/libgmp-10.lib
Found MPFR: F:/CGAL-5.5.1/auxiliary/gmp/lib/libmpfr-4.lib
Found Boost: F:/boost_1_81_0/boostmake/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found suitable version "1.81.0", minimum required is "1.66")
Boost include dirs: F:/boost_1_81_0/boostmake/include/boost-1_81
Boost libraries:
Performing Test CMAKE_HAVE_LIBC_PTHREAD
Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
Looking for pthread_create in pthreads
Looking for pthread_create in pthreads - not found
Looking for pthread_create in pthread
Looking for pthread_create in pthread - not found
Found Threads: TRUE
Found Boost 1.81.0 at F:/boost_1_81_0/boostmake/lib/cmake/Boost-1.81.0
Requested configuration: QUIET COMPONENTS program_options
BoostConfig: find_package(boost_headers 1.81.0 EXACT CONFIG QUIET HINTS F:/boost_1_81_0/boostmake/lib/cmake)
BoostConfig: find_package(boost_program_options 1.81.0 EXACT CONFIG QUIET HINTS F:/boost_1_81_0/boostmake/lib/cmake)
Found boost_program_options 1.81.0 at F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0
Boost toolset is vc142 (MSVC 19.29.30145.0)
Scanning F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0/libboost_program_options-variant*.cmake
Including F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0/libboost_program_options-variant-vc142-mt-gd-x32-1_81-static.cmake
[ ] libboost_program_options-vc142-mt-gd-x32-1_81.lib
Including F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0/libboost_program_options-variant-vc142-mt-gd-x64-1_81-static.cmake
[ ] libboost_program_options-vc142-mt-gd-x64-1_81.lib
Including F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0/libboost_program_options-variant-vc142-mt-x32-1_81-static.cmake
[ ] libboost_program_options-vc142-mt-x32-1_81.lib
Including F:/boost_1_81_0/boostmake/lib/cmake/boost_program_options-1.81.0/libboost_program_options-variant-vc142-mt-x64-1_81-static.cmake
[ ] libboost_program_options-vc142-mt-x64-1_81.lib
Could NOT find Boost: missing: program_options (found F:/boost_1_81_0/boostmake/lib/cmake/Boost-1.81.0/BoostConfig.cmake (found version "1.81.0"))
NOTICE: This project requires Boost Program Options and will not be compiled.
Configuring done (5.9s)
Solution
I have found a solution, but I'm not clear on the underlying principle. My code can only use the exe version of the Boost library and cannot use my own compiled version. I have tried many versions, and only Boost libraries 1.74 and 1.66 do not throw this error, allowing for successful compilation.
Answered By - Zimao Answer Checked By - David Goodson (WPSolving Volunteer)