Created
August 20, 2024 12:05
-
-
Save AndreiCherniaev/8a081ccafc36d32935150b29ee1c8256 to your computer and use it in GitHub Desktop.
CMake lib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.16) | |
project(linklib_example LANGUAGES CXX) | |
set(CMAKE_AUTOMOC ON) | |
set(CMAKE_CXX_STANDARD 17) | |
set(CMAKE_CXX_STANDARD_REQUIRED ON) | |
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core ) | |
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core ) | |
qt_add_executable(${PROJECT_NAME} | |
main.cpp | |
Rial.cpp Rial.h | |
my_v4l2-ctl.h | |
) | |
## Your-external "mylib", add GLOBAL if the imported library is located in directories above the current. | |
#add_library( mylib SHARED IMPORTED ) | |
## You can define two import-locations: one for debug and one for release. | |
#set_target_properties( mylib PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/res/mylib.so ) | |
add_library( libv4l2-ctl_library SHARED IMPORTED GLOBAL ) | |
# You can define two import-locations: one for debug and one for release. | |
set_target_properties( libv4l2-ctl_library PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_LIST_DIR}/libv4l2-ctl_library.so ) | |
target_link_libraries(${PROJECT_NAME} PUBLIC | |
Qt::Core | |
) | |
target_link_libraries(${PROJECT_NAME} PUBLIC | |
libv4l2-ctl_library | |
) | |
# target_include_directories(libv4l2-ctl_library PUBLIC "my_v4l2-ctl.h") | |
install(TARGETS ${PROJECT_NAME} | |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment