Im trying to build an OSX bundle with Clion and Cmake, Currently the library links correctly in terms of I have no pre compile errors but when I build and try to run the program I get the following error
dyld: Library not loaded: libxl.dylib Referenced from: /path/to/executable/ Reason: image not found
Ive searched on this issue and cant seem to find a clear solution, This is probably due to my lack of experience with CMake and C++.
If anyone has a solution or can point me in the direction of what I should be reading to further understand this it would be much appreciated.
See CMakeLists.txt below
cmake_minimum_required(VERSION 3.7) project(project name) set(CMAKE_CXX_STANDARD 14) set(SOURCE_FILES main.cpp) find_package( Qt5Core REQUIRED ) find_package( Qt5Widgets REQUIRED ) find_package( Qt5Gui REQUIRED ) set(PROJECT_LINK_LIBS libxl.dylib) link_directories(${CMAKE_SOURCE_DIR}/LibXL/lib) include_directories(${CMAKE_SOURCE_DIR}/LibXL/include_cpp) #Mac Bundle (Built on Mac) add_executable(project_target_mac MACOSX_BUNDLE main.cpp) qt5_use_modules( project_target_mac Core Widgets Gui ) target_link_libraries(project_target_mac Qt5::Widgets) target_link_libraries(project_target_mac ${PROJECT_LINK_LIBS} ) #set_target_properties(project_target_mac PROPERTIES INSTALL_RPATH "${CMAKE_SOURCE_DIR}/LibXL/lib") add_executable(project_target ${SOURCE_FILES}) qt5_use_modules( project_target Core Widgets Gui ) target_link_libraries(project_target Qt5::Widgets) target_link_libraries(project_target ${PROJECT_LINK_LIBS } )