Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7724727
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:45:37+00:00 2026-06-01T04:45:37+00:00

I am trying to simplify a large project by having cmake compile it all

  • 0

I am trying to simplify a large project by having cmake compile it all for me, but i am having trouble compiling the boost unit tests. The cmake file for my simple example is shown below.

cmake_minimum_required(VERSION 2.8)
find_package(Boost COMPONENTS system filesystem REQUIRED)
add_excecutable(testTheTester boostTester.cpp)
target_link_libraries(testTheTester ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
add_test(tester tester)

and the code in boostTester.cpp is:

#define BOOST_TEST_MAIN
#if !defined( WIN32 )
    #define BOOST_TEST_DYN_LINK
#endif
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE( la ) {
    BOOST_CHECK_EQUAL(1, 1)
}

Now this cpp code will compile and run fine if i build it manually with:

g++ boostTester.cpp -o output -lboost_unit_test_framework

and the cmake works fine but when using the output make file the make crashes with a huge amount of errors the first of which is this:

undefined referance to 'boost::unit_test::unit_test_log_t::set_checkpoint(boost... bla bla

now my initial thought is that the cmake is not linking the boost library correctly and I have tried many commands and combinations with no luck. Does anyone know how to link the boost_unit_test in a cmake file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T04:45:39+00:00Added an answer on June 1, 2026 at 4:45 am

    You need to include the unit test framework in the list of requirements in the find_package command, and then link it:

    find_package(Boost COMPONENTS system filesystem unit_test_framework REQUIRED)
    ...
    target_link_libraries(testTheTester
                          ${Boost_FILESYSTEM_LIBRARY}
                          ${Boost_SYSTEM_LIBRARY}
                          ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
                          )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having some trouble trying to simplify some logic that is contained in
Trying to keep all the presentation stuff in the xhtml on this project and
I'm trying to solve a gitignore problem on a large directory structure, but to
I'm trying to simplify a bunch of header file include spaghetti by using forward
I'm trying to simplify a form (using ASP.NET MVC but I guess that might
All, I am trying to simplify a RelaxNG schema using Eric van der Vlist's
Hi I'm trying to simplify this code but can't think which way to do
I'm trying to simplify/improve the Makefile for compiling my thesis. The Makefile works nicely
Im trying to simplify my package.xml file, because it contains many of this <phprelease>
I'm trying to write something to simplify experimentation with SVG path, but i have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.