I have a very simple CMake file which works fine on linux, but on windows, it says that it cannot find boost (even though it seems to find it, as it says "found suitable version"). Here is the initial build file:
cmake_minimum_required(VERSION 3.16.3)
project(filecompare)
set(CMAKE_CXX_STANDARD 20)
find_package(Boost 1.73.0 COMPONENTS program_options)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(filecompare filecompare.cpp)
target_link_libraries(filecompare ${Boost_LIBRARIES})
endif()
CMake output:
-- Could NOT find Boost (missing: Boost_INCLUDE_DIR program_options) (Required is at least version "1.73.0")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/repos/filecompare/cmake-build-debug
So it seems it cannot find the library on its own, so I added these lines above find_package:
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:/local/boost_1_73_0")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:/local/boost_1_73_0/lib64-msvc-14.2")
Now it somehow seems to find the library, but doesn't, here is the output:
-- Could NOT find Boost (missing: program_options) (found suitable version "1.73.0", minimum required is "1.73.0")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/repos/filecompare/cmake-build-debug
I tried setting stuff like:
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
SET(BOOST_ROOT "C:/local/boost_1_73_0/boost")
but that doesn't help either. So what am I doing wrong here? I'm using the clang-cl on CLion with VisualStudio 2019