Dennis Luehring wrote:
if(UNIX AND NOT APPLE) set( MY_BOOST_DIR "/home/linux/temp/boost_1_75_0/_x64/lib/cmake" ) else() set( MY_BOOST_DIR "D:/temp/boost_1_75_0/_x64/lib/cmake" ) endif()
list(APPEND CMAKE_PREFIX_PATH ${MY_BOOST_DIR})
add_executable(test test.cpp)
find_package(Boost CONFIG REQUIRED COMPONENTS unit_test_framework)
In principle this can equivalently be find_package(Boost CONFIG REQUIRED COMPONENTS unit_test_framework PATHS "/home/linux/temp/boost_1_75_0/_x64" "D:/temp/boost_1_75_0/_x64") although in the real project the paths probably shouldn't be hardcoded in the CMakeLists.txt file.
target_link_libraries(test ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
This should be target_link_libraries(test Boost::unit_test_framework) The variables are old style CMake and shouldn't be used nowadays.