CMake Automoc Error 1 - Can't compile project - c++

I just moved a project I built in Qt5 into my CMake project tree.
I exported the project in the CMake directory. However as I try to build the project the compiler gives me the following error:
[src/GUIconceptStudy/CMakeFiles/GUIconceptStudy_automoc] Error 1
See also the following print screen attached:
Also the CMakeLists.txt files is below:
cmake_minimum_required (VERSION 3.1)
project(GUIconceptStudy)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package( OpenCV REQUIRED )
find_package( Boost COMPONENTS system thread filesystem REQUIRED)
#find_package (sqlite3)
find_package(Qt5 REQUIRED COMPONENTS Core Quick)
###
### make sure we use c++11
###
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
###
###boost include stuff (required for all libcam)
###
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
find_package(Qt5Widgets)
find_package(Qt5PrintSupport)
#find all the qt UI stuff
file(GLOB UI
"ui/*.ui"
)
#make them into headers
qt5_wrap_ui (UI_HDRS ${UI})
###
### add all your non QT sources
###
# find all non ui sources
file(GLOB SRCS
"src/*.h"
"src/*.cpp"
"src/*.hpp"
)
# find all ui related sources
file(GLOB UI_SRCS
"ui/*.h"
"ui/*.cpp"
"ui/*.hpp"
)
###
### Add executables
###
add_executable(GUIconceptStudy main/main.cpp ui/qrc/res.qrc ${SRCS} ${UI_HDRS} ${UI_SRCS})
target_link_libraries (GUIconceptStudy Qt5::Widgets ${Boost_LIBRARIES} ${OpenCV_LIBS} Qt5::PrintSupport Qt5::Core Qt5::Quick)
###
### Add Library
###
add_library(GUIconceptStudy_lib SHARED ui/qrc/res.qrc ${SRCS} ${UI_HDRS} ${UI_SRCS})
target_link_libraries (GUIconceptStudy_lib Qt5::Widgets ${Boost_LIBRARIES} ${OpenCV_LIBS} Qt5::PrintSupport Qt5::Core Qt5::Quick)
After looking at different on-line sources I could't find anything particularly useful. Anyone who can shed a little bit of light on what the problem could be?

It's a shot in a dark but this is most likely caused by the missing set(CMAKE_INCLUDE_CURRENT_DIR ON). As said in the documentation it should set because generated files are not in your source directory:
Generated moc_*.cpp and *.moc files are placed in the build directory so it is convenient to set the CMAKE_INCLUDE_CURRENT_DIR variable.
Another mistake I see people doing is mixing Qt processing pipelines. I've mentioned this already in my other answers. As it says in documentation on AUTOUIC property you shouldn't use qt5_wrap_ui function when this property is enabled.

Related

VS 2019 CMake looking for file it is not supposed to

I run into a problem when building a Cmake Project with CmakeLists.txt in VS 2019.
It tells me this:
What I did before the error:
I created a tests folder
I created a test.cpp file
A Pop up window opened from Cmake -> asking if I want to add it automatically to add_executable, I declined it
I manually added it to the Project Sources with tests/test.cpp
test got highlighted blue, so I changed the name to sample_test.cpp
rewrote test.cppp to sample_test.cpp
build CmakeLists.txt
error
I hope the provided information is enough otherwise let me know and thanks in advance!
What I tried:
deleting the cache
deleting the out file
deleting CMakeSettings.Json
repaired VS 2019
uninstalled CMake and reinstalled
Added the "ghost" file -> results in same error message
deleted repo and cloned it in a completely new directory
deleted .vs file
reinstalling VS 2019
deleting VS with InstallCleanup.exe, removed every VS file and reinstalled
Good to know:
On a colleagues machine it build without problems, so on his machine Cmake doesn't look for this file. So the problem seems to be locally on the machine.
Also I do not want this file and folder anymore, I have deleted it and somehow CMake is still looking for it.
cmake_minimum_required(VERSION 3.5)
project(team1 VERSION 0.1 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(OpenCV REQUIRED)
find_package(PCL REQUIRED COMPONENTS common visualization io)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
userinterface.h userinterface.cpp
fileviewer.h fileviewer.cpp
segmentcreator.h segmentcreator.cpp
filerepresentation.h filerepresentation.cpp
filehandler.h filehandler.cpp
utils/utils.cpp utils/utils.h
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(${PROJECT_NAME}
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(${PROJECT_NAME} SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
else()
add_executable(${PROJECT_NAME}
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(${PROJECT_NAME}
PRIVATE Qt${QT_VERSION_MAJOR}::Widgets
${OpenCV_LIBS}
${PCL_LIBRARIES}
)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
install(TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
target_include_directories(${PROJECT_NAME} PUBLIC
${OpenCV_INCLUDE_DIRS}
)
target_link_directories(${PROJECT_NAME} PUBLIC
${PCL_LIBRARY_DIRS}
${OpenCV_LIBRARY_DIRS}
)
add_definitions(${PCL_DEFINITIONS})
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(${PROJECT_NAME})
endif()
I found a solution. I reinstalled Qt and it worked. I don't know if Qt somehow caches the files that are supposed to be used in a project, but reinstalling it at least made the CMake generate again without errors.
Maybe someone knows more about what Qt does there, I am curious to know.

How to properly add qrc (resource) folder on CMAKE for catkin workspace

I have been trying to include in my CMAKE file a resource folder. Contrarily to a typical folder, this is a catkin_ws, and that is why I am having a bit of difficulties:
Project compiles but when I launch the GUI, there are no icons, which means that catkin does not see correctly the resource folder:
Belwo is my CMAKE file:
cmake_minimum_required(VERSION 2.8.3)
project(project)
add_compile_options(-std=c++11)
find_package(catkin REQUIRED COMPONENTS
roscpp
pcl_conversions
pcl_ros
std_msgs
lidar_boat_detection
rviz
)
###
### QT
###
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport)
#find all the qt UI stuff
file(GLOB UI
"src/filterPCDInterface/*.ui"
)
#make them into headers
qt5_wrap_ui (MB_UI_HDRS ${UI})
# Generate resources
qt5_add_resources(RESOURCES_RCC ${RESOURCE})
include_directories(include ${catkin_INCLUDE_DIRS})
file(GLOB SRCS
"src/filterPCDInterface/*.h"
"src/filterPCDInterface/*.cpp"
"src/filterPCDInterface/*.hpp"
)
file(GLOB QT_SRCS
"src/filterPCDInterface/*.h"
"src/filterPCDInterface/*.cpp"
"src/filterPCDInterface/*.hpp"
)
## Declare a catkin package
catkin_package()
add_executable(filterpcdinterface ${MB_UI_HDRS} ${QT_SRCS} ${SRCS} ${RESOURCE})
target_link_libraries(filterpcdinterface Qt5::Widgets Qt5::PrintSupport Qt5::Core ${catkin_LIBRARIES} ${PCL_LIBRARIES} )
My res.qrc is the one below:
<RCC>
<qresource prefix="/icons">
<file>down-arrow.png</file>
<file>leftArrow.png</file>
<file>rightArrow.png</file>
<file>uoArrow.png</file>
</qresource>
</RCC>
Also below is a print screen of my resource file:
Below also how my node folder. In order to get to the icons the path is src/folderA/qrc/icons.png
What I have done so far:
1) I found a very useful source that really helped to set almost all the project and the related catkin_ws. I also followed what was said in the post but still catkin_make does not see the resource file. It compiles but when I launch the GUI, there are no icons.
2) Also I came across this additional source which was useful but still not able to solve the problem I have.
Please point to the right direction to solve this issue.

Qt Creator Error: cannot find -lopencv_imgcodecs

I have installed opencv, qt, qt creator, cmake on ubuntu 15.10 through VMware on windows.
The opencv is installed in this directory: /home/majidalaeinia/opencv/
The project repository is cloned in this directory: /home/majidalaeinia/Desktop/imgwarp-opencv/
I want to run the project through its CMakeLists.txt in qt creator and when I press Build now on qt creator, I get the following errors:
error: cannot find -lopencv_imgcodecs
error: collect2: error: ld returned 1 exit status
Where is the problem and how can I solve it?
# Majid Alaeinia, from the CMakeLists.txt file you posted it is not specified how CMAKE should find the libraries requested from your project. Also there are no target_link_libraries declared so CMAKE does not know where to link them. Hopefully the following small example template should be helpful for your project:
cmake_minimum_required (VERSION 3.1)
project(yourProject)
find_package( OpenCV REQUIRED )
find_package( Qt5 REQUIRED COMPONENTS Sql )
### this is for c++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
### QT stuff if you want a GUI
set(CMAKE_AUTOMOC ON) # autogenerate qt gui features
set(CMAKE_AUTORCC ON) # used for QT resource Files (if you need)
## Additional operation...
# From here you are specifically linking all OpenCV libraries and executables
### Add executables
add_executable(yourExecutable main/main.cpp ui/res/res.qrc ${SRCS} ${UI_HDRS} ${UI_SRCS})
target_link_libraries (yourProject example Qt5::Widgets ${OpenCV_LIBS} Qt5::Sql)
### Add Library
add_library(yourProject_lib SHARED ${SRCS} ${UI_HDRS})
target_link_libraries (yourProject_lib example Qt5::Widgets ${OpenCV_LIBS})
# Majid Alaeinia,I uploaded the repository and went through the code. if you go inside the demo folder and you change the present CMakeLists.txt file with the one I provided below it should compile (It does compile on mine with the provided changes):
project(demo)
cmake_minimum_required(VERSION 2.6)
find_package(Qt5 REQUIRED COMPONENTS Widgets Core)
FIND_PACKAGE( OpenCV REQUIRED )
include_directories(${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib ${CMAKE_CURRENT_SOURCE_DIR})
set(demo_SRCS main.cpp projfile.cpp deformwin.cpp myimage.cpp singlephotoview.cpp pointspaint.cpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
#qt5_automoc(${demo_SRCS})
QT5_WRAP_CPP(QOBJ_CPP ${demo_SRCS})
qt5_wrap_ui(helloworld_FORMS_HEADERS deformwin.ui)
add_executable(demo ${demo_SRCS} ${helloworld_FORMS_HEADERS})
target_link_libraries(demo ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} imgwarp-lib opencv_core opencv_imgproc opencv_imgcodecs)
The code in the repository is an old code and still carries Qt4 as main wrappers. I think you probably have Qt5 installed on your computer and in fact the code I provided it will work for Qt5. Use it as a guideline for the other CMakeLists.txt file present inside src folder and change accordingly.
CMake will compile but because it was used Qt4 you need to figure out the most important modules to add, for example the new standard for including QtGui/QApplication is usually substituted by QtWidgets/QApplication
I also wanted to leave my previous answer in case you need a starting point or a initial template. I hope this clarifies a bit more and can get you move forward for your project.

What does this strange "/usr/bin/ld: cannot find -lXAW_LIBRARY-NOTFOUND" error mean?

I created a ROS2 rviz plugin in C++ which I need to compile into a shared library (.so) using cmake. I already have a working CMakeLists.txt (see below) which creates a static library (.a); I need it to be shared, though.
However, when I add the SHARED keyword to the add_library macro (commented out in the code below), it throws this strange error:
/usr/bin/ld: cannot find -lXAW_LIBRARY-NOTFOUND
Now, I have looked at the many "/usr/bin/ld: cannot find [some library]" questions here on SO (like this), but my error seems to be more strange since it seems to contain an error ("-lXAW_LIBRARY-NOTFOUND") IN THE error (/usr/bin/ld: cannot find...). I mean, why is he even looking for a library called LIBRARY_NOTFOUND??
I'm on Ubuntu xenial 16.04 using cmake 3.10.
CMakeLists.txt:
project(traffic_sign_delegation_manager)
set(CMAKE_CXX_STANDARD 17)
if(NOT WIN32)
add_definitions(-fPIC)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-deprecated-declarations)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rviz_common REQUIRED)
find_package(std_msgs REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rosidl_generator_cpp)
find_package(pluginlib REQUIRED)
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets)
set(msg_files
"msg/TrafficSignList.msg"
"msg/TrafficSign.msg"
"msg/TrafficSignSetList.msg"
"msg/TrafficSignSet.msg"
"msg/TrafficSignSetStatus.msg"
"msg/TrafficSignsManaged.msg"
"msg/AccLever2.msg"
"msg/VehicleOdometry.msg"
)
rosidl_generate_interfaces(${PROJECT_NAME}
${msg_files}
DEPENDENCIES std_msgs
)
link_directories(${ament_cmake_LIBRARY_DIRS})
add_definitions(-DQT_NO_KEYWORDS)
qt5_wrap_ui(QT_UI_FILES ui/traffic_sign_delegation_manager_panel.ui)
qt5_wrap_ui(QT_UI_FILES ui/traffic_sign_list_item.ui)
qt5_add_resources(QT_QRC_FILES ui/traffic_sign_delegation_manager.qrc)
set_property(SOURCE traffic_sign_delegation_manager_panel.h PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE draw_area.h PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE adv_interaction_groupbox.h PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE traffic_sign_delegation_manager_display.h PROPERTY SKIP_AUTOMOC ON)
add_library(delegator_lib # SHARED # <=== WHY IS THIS NOT WORKING?
vec2d.cpp
vec2d.h
traffic_sign_delegation_manager_panel.cpp
traffic_sign_delegation_manager_panel.h
draw_area.cpp
draw_area.h
traffic_sign_delegation_manager_display.cpp
traffic_sign_delegation_manager_display.h
adv_interaction_groupbox.cpp
adv_interaction_groupbox.h
ui/traffic_sign_list_item.ui
ui/traffic_sign_delegation_manager_panel.ui
${QT_UI_FILES}
${MOC_FILES}
)
rosidl_target_interfaces(delegator_lib ${PROJECT_NAME} "rosidl_typesupport_cpp")
target_include_directories(delegator_lib PUBLIC
${rvizCommon_DIR}
${rosidl_generator_cpp_INCLUDE_DIRS}
${ament_cmake_INCLUDE_DIRS}
${rviz2_INCLUDE_DIRS}
${rviz_common_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
${Qt5_INCLUDE_DIRS}
)
target_link_libraries(delegator_lib
rviz_common::rviz_common
)
target_compile_definitions(delegator_lib PRIVATE "RVIZ_DEFAULT_PLUGINS_BUILDING_LIBRARY")
target_compile_definitions(delegator_lib PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
pluginlib_export_plugin_description_file(rviz_common plugin_description.xml)
ament_target_dependencies(delegator_lib
geometry_msgs
laser_geometry
nav_msgs
map_msgs
rclcpp
resource_retriever
urdf
visualization_msgs
)
ament_export_include_directories(${INCLUDE_DIRS} ${ament_cmake_INCLUDE_DIRS} include)
ament_export_interfaces(delegator_lib HAS_LIBRARY_TARGET)
ament_export_dependencies(
Qt5
rviz_common
geometry_msgs
laser_geometry
map_msgs
nav_msgs
rclcpp
urdf
visualization_msgs
rosidl_generator_cpp
)
install(FILES plugin_description.xml
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY images
DESTINATION share/${PROJECT_NAME})
install(DIRECTORY ui
DESTINATION share/${PROJECT_NAME}
PATTERN "*.ui"
EXCLUDE)
install(
TARGETS delegator_lib
EXPORT delegator_lib
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
install(
DIRECTORY "${CMAKE_SOURCE_DIR}/icons"
DESTINATION "share/${PROJECT_NAME}"
)
ament_package()
Please note: This question is not about ROS; I am not a cmake wizard, so probably I'm just doing something terribly wrong in cmake... I already asked a more broad version of this question on answers.ros, but it appears to be too cmake-specific or something. Anyway, I did not get an answer there. (The above code is not an MWE, sorry; I could create one if neccessary, but it would require ROS2 to compile...)
Normally that error pops up if you are giving some library names as arguments to the target_link_libraries function.
Either,
The names are not correct or,
The path is not or,
The libraries are not installed.
I'd look at target_link_libraries(delegator_lib rviz_common::rviz_common) and link_directories(${ament_cmake_LIBRARY_DIRS}) as suspects.
In CMake you can use MESSAGE command to do debugging of sorts where you can display the values of the CMake variables to check if they make sense with what is on the system.
Also you can try installing the XAW library like this sudo apt-get install libxaw7-dev. Could be that one of the libraries that you link to has a dependency on the XAW library.

LINK : fatal error LNK1181: cannot open input file '\machine:x64.obj'

I am porting a C++ project I have been working on for 2 years, to Windows, and I am facing this link issue, that I haven't seen on any google-referenced posts... :/
It is a CMake-generated project, and I get these CMake entries set by default to "\machine:x64"
CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS
I tried removing the flag, which has no effect on any of the 3 last entries, but CMAKE_EXE_LINKER_FLAGS without this value gives me about 85 unresolved externals spread in my libraries.
ALL my projects / project dependencies are compiled with MSVC2015 in x64.
Linking fails both in debug & release mode (not that it matters..)
I should also probably mention that I have 6 projects in this solution, 4 libraries, 2 executables. 4 of these projects are compiling fine (1 executable & 4 libs), only the 2 last ones are failing (with the same link error for both).
The only difference in terms of dependencies are a dependency to the Point Cloud Library (pcl), and to Qt5 (Core GUI, XML, and OpenGL)
Did anyone already encountered this specific linker error?
Hope you can help =)
EDIT: Here are the 2 main CMakelists files (the one at the root of the project and the one that compiles both failing projects). I removed everything that didn't seem pertinent for this issue.
Root CMakeLists.txt:
project(SofaOR)
cmake_minimum_required(VERSION 2.4)
if (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
include_directories(${CMAKE_SOURCE_DIR})
#Reading local file for the non automatically detected dependencies
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake/dependencies.cmake")
message("Adding custom file")
include(${CMAKE_CURRENT_LIST_DIR}/cmake/dependencies.cmake)
endif()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(SOFA_ALL_LIBS SofaHelper SofaDefaultType)
set(SOFA_INCLUDE_DIRS ${SOFA_DIR}/include)
set(SOFA_LIBRARY_DIRS ${SOFA_DIR}/lib)
add_subdirectory(${CMAKE_SOURCE_DIR}/processOR)
the CMakelists included by the last add_subdirectory:
project(processOR)
cmake_minimum_required(VERSION 3.0.2)
if (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
set(PROCESSOR_EXEC_NAME processOR)
set(PROCESSOR_LIB_NAME processOR_lib)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(OpenCV COMPONENTS core imgproc xfeatures2d calib3d REQUIRED )
find_package(Qt5 COMPONENTS Core Gui Xml OpenGL REQUIRED )
find_package(PCL COMPONENTS common io kdtree REQUIRED )
find_package(Boost COMPONENTS program_options chrono thread REQUIRED)
find_package(OpenIGTLink REQUIRED )
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(PROCESSOR_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/src/ PARENT_SCOPE)
set(PROCESSOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/)
include_directories(${PCL_INCLUDE_DIRS})
include_directories(${COMMON_INCLUDE_DIRS})
include_directories(${OpenIGTLink_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${QGLVIEWER_DIR})
include_directories(${Boost_INCLUDE_DIRS})
include_directories(${SOFA_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
link_directories(${COMMON_LIBRARY_DIRS})
link_directories(${OpenIGTLink_LIBRARY_DIRS})
link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(${QGLVIEWER_DIR})
link_directories(${SOFA_LIBRARY_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
include_directories(${PROCESSOR_SRC})
set(PROCESSOR_ALL_LIBS
${PCL_LIBRARIES}
${COMMON_LIBRARIES}
OpenIGTLink
${OpenCV_LIBS}
QGLViewer
${Boost_LIBRARIES}
${SOFA_ALL_LIBS}
)
set (HEADER_FILES
${PROCESSOR_SRC}/util/Calibration.h
${PROCESSOR_SRC}/fetchers/VideoFetcher.h
[…]
${PROCESSOR_SRC}/filters/PointCloudTriangulator.h
${PROCESSOR_SRC}/filters/PointCloudSmootherMLS.h
${PROCESSOR_SRC}/filters/PointCloudSegmenter.h
${PROCESSOR_SRC}/filters/PointCloudDownSampler.h
)
set (SOURCE_FILES
${PROCESSOR_SRC}/Registrator.cpp
${PROCESSOR_SRC}/tinyxml2.cpp
[…]
${PROCESSOR_SRC}/filters/PointCloudSegmenter.cpp
${PROCESSOR_SRC}/filters/PointCloudDownSampler.cpp
)
# Library
add_library(${PROCESSOR_LIB_NAME} SHARED ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROCESSOR_LIB_NAME} ${PROCESSOR_ALL_LIBS} ${CMAKE_EXE_LINKER_FLAGS} ${ADDITIONAL_LIBRARIES})
QT5_USE_MODULES(${PROCESSOR_LIB_NAME} Widgets Gui OpenGL Xml)
set(PROCESSOR_LIB ${PROCESSOR_LIB_NAME} PARENT_SCOPE)
# Main executable
set (SOURCE_FILES
${PROCESSOR_SRC}/mainRegistration.cpp
)
add_executable(${PROCESSOR_EXEC_NAME} ${HEADER_FILES} ${SOURCE_FILES})
target_link_libraries(${PROCESSOR_EXEC_NAME} ${PROCESSOR_LIB} ${Boost_LIBRARIES} ${PROCESSOR_LIB_NAME} ${CMAKE_EXE_LINKER_FLAGS})
QT5_USE_MODULES(${PROCESSOR_EXEC_NAME} Widgets Gui OpenGL Xml)
set_target_properties(${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
)