0

I have a test file that uses Boost libraries and it builds correctly. My goal is to run the test cases by setting up a run configuration in QT Creator.

I have tried to set the test file as an executable with cmake, and it builds correctly.

cmake_minimum_required(VERSION 3.5)

project(sps LANGUAGES CXX)
enable_testing()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Boost COMPONENTS unit_test_framework REQUIRED)

add_executable(test_sps test/test_sps.cpp)
target_link_libraries(test_sps Boost::unit_test_framework)

test/test_sps.cpp looks like this

BOOST_AUTO_TEST_SUITE(SuiteSPS)

BOOST_AUTO_TEST_CASE(TestSingleNode){
    ...
}

BOOST_AUTO_TEST_CASE(TestSingleBranch){
    ...
}

BOOST_AUTO_TEST_SUITE_END()

The problem happens when I try to set up a run configuration. I set up a custom executable as the test/test_sps.cpp file, but QT Creator is saying that "The path ... is not an executable file"

How do you set up a run configuration for running Boost tests?

John Glen
  • 771
  • 7
  • 24

1 Answers1

0

Being unfamiliar with cmake, I did not realize that add_executable(NAME, FILE) would create an executable named NAME in the build folder. This means after build files are generated by cmake, the run config can be pointed to the executable generated by cmake.

John Glen
  • 771
  • 7
  • 24