I want to use UnitTest++ in my project but I get an error on compiling:
CMakeFiles/BNN.dir/main.cpp.o:-1: In function `main':
BNN/main.cpp:-1: error: undefined reference to `UnitTest::RunAllTests()'
:-1: error: collect2: error: ld returned 1 exit status
I searched the web for an answer and tried several things that's what I have right now:
project(BNN)
cmake_minimum_required(VERSION 2.8)
file(GLOB SRC "*.cpp" "src/*.h" "src/*.cpp")
file(GLOB DATA_FILE "*.md")
find_package(UnitTest++ REQUIRED)
include_directories(${UnitTest++_INCLUDE_DIRS})
set(LIBS ${LIBS} ${UnitTest++_LIBRARY})
add_executable(${PROJECT_NAME} ${SRC} ${DATA_FILE})
target_link_libraries(${PROJECT_NAME} ${LIBS})
I build the library by following the official guide:
cd path/to/unittest-cpp/builds
cmake -G "<Choose a valid generator>" ../
cmake --build ./
sudo cmake --build ./ --target install
My OS is ArchLinux.
What do I have to do so I can compile it with cmake?