Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to working with the third-party static library(Ex: libusb-1.0.lib) #25

Closed
rick-hanpin opened this issue Nov 2, 2022 · 2 comments
Closed
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@rick-hanpin
Copy link

Hello Frang:
I'm new to NAppGUI and CMake. about below question I can't find any answer on Google.
When add new project by command "desktopApp("TestUSB" "Ben/TestUSB" "" NRC_NONE)", and add the "target_link_libraries(TestUSB usb-1.0)" to CMakeLists.txt file on my new project folder , but this file will be updated automatic every time when CMake configure.
How does the best way the NAppGUI working with a third-party library (Example; libusb-1.0.lib libusb-1.0.a ), if I don't want re-compiler the third-party library source code?

@frang75
Copy link
Owner

frang75 commented Nov 3, 2022

Hi @rick-hanpin, thank you for use NAppGUI!

You can link to the external library within the main CMakeLists.txt (/src/CMakeLists.txt). Indeed, the CMakeLists.txt in the subfolders are temporary and will be rewritten.

desktopApp("TestUSB" "Ben/TestUSB" "" NRC_NONE)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
    target_link_libraries(TestUSB PRIVATE "/library/windows_folder/libusb-1.0.lib")
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
    target_link_libraries(TestUSB PRIVATE "/library/linux_folder/libusb-1.0.a")
endif()

@frang75 frang75 self-assigned this Nov 3, 2022
@frang75 frang75 added the documentation Improvements or additions to documentation label Nov 3, 2022
@rick-hanpin
Copy link
Author

Hi @frang75
Thank you for taking the time to reply, I implemented it according to your suggestion, and the result has been successful.

@frang75 frang75 closed this as completed Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants