Help with cmake
-
I'm trying to migrate a small "project":https://github.com/matheusssilva/DynamicQtWidgets to cmake, but I am not succeeding in creating the cmake file.
The project consists of a dynamic library and a unit test. First the library must be compiled and then the test should be compiled because the test includes the dynamic library.
my cmake file
@#minimum version required
cmake_minimum_required(VERSION 2.8)#set variable for project name
set (LIB_NAME "$dynamicqtwidgets")#set variable current dir
set (ROOT "$CMAKE_CURRENT_SOURCE_DIR")#project name
project(PRO_NAME)#dirs
list (APPEND DIRS
"${ROOT}/dynamicqtwidgets"
)#include dir
include_directories(${DIRS})#look in binary dir for include moc files
set (CMAKE_INCLUDE_CURRENT_DIR ON)#run moc if needed
set (CMAKE_AUTOMOC ON)#find Qt5 widgets libs
find_package(Qt5Widgets REQUIRED)add_library(dynamicqtwidgets SHARED dynamicqtwidgets_global.hpp dynamicqtwidgets.hpp dynamicqtwidgets.cpp)
add_executable(tests dynamicqtwidgetstests.hpp dynamicqtwidgetstests.cpp main.cpp)
target_link_libraries(tests dynamicqtwidgets)@
erro
-CMake Error at CMakeLists.txt:30 (add_library):
Cannot find source file:dynamicqtwidgets_global.hpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx- -
Hi,
in add_library, add_executable the sources must specified in absolute PATH or in PATH relative to the CMakeLists.txt file.