Our company uses CMake currently to build our executables for Windows. I'm working on making our application work on Mac. So far the application builds fine on the Mac. However, when I try to open the Executable that CMake creates for the Mac, I get the following error in a terminal window:
Last login: Tue Apr 16 14:34:58 on ttys001
Locals-MacBook-Pro:~ auser$ /Users/auser/Documents/Projects/CodeMonkey/bin/CmDeveloperKit ; exit;
dyld: Library not loaded: libAbcSupport.dylib
Referenced from: /Users/auser/Documents/Projects/CodeMonkey/bin/CmDeveloperKit
Reason: image not found
Trace/BPT trap: 5
logout
[Process completed]
I'm thinking that the CMakeLists.txt for the project might not be setup correctly to build the executable for the Mac. I've included it below:
# Includes the common stuff for CodeMonkey
include(CmConfig)
# Set the file description
set(CMDEVELOPERKIT_FILE_DESCRIPTION "CodeMonkey Application")
# Configures this CodeMonkey module
CmModuleConfig(CmDeveloperKit FIND CodeMonkey CodeMonkeyGui)
# Get source files for CodeMonkeyGui
set(PROJECT_SOURCES ${PROJECT_SOURCES} Main.cpp)
# Only add resource files on Windows
if(WIN32)
# Get header files for CodeMonkeyGui
set(PROJECT_HEADERS ${PROJECT_HEADERS} CmIcon.h)
# Get source files for CodeMonkeyGui
set(PROJECT_RESOURCES ${PROJECT_RESOURCES} CmIcon.rc)
endif(WIN32)
# Add additional include directories
include_directories(${CODEMONKEY_INCLUDE_DIR} ${CODEMONKEYGUI_INCLUDE_DIR} ${ABC_INCLUDE_DIR})
# Add additional link directories
link_directories("${ABC_LIBRARY_DIR}")
# Creates the executable
if(WIN32)
add_executable(${PROJECT_NAME} WIN32 ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_RESOURCES})
# Sets entry point to main
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"")
else()
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${PROJECT_RESOURCES})
endif(WIN32)
# Add the d in debug
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d)
# Links to the other required libs
target_link_libraries(${PROJECT_NAME} ${CODEMONKEY_LIBRARY} ${CODEMONKEYGUI_LIBRARY}
${ABC_ARASUPPORT_LIBRARY} ${ABC_ARAGUI_LIBRARY})
# Sets the appropriate dependencies
add_dependencies(${PROJECT_NAME} ${CODEMONKEY_NAME} ${CODEMONKEYGUI_NAME})
# Configure the install procedures
CmModuleInstall()
Could someone please let me know what I'm missing or have wrong in the above file? If this file is not the issue can you point me in the right direction for a fix?
libAbcSupport.dylib
toDYLD_LIBRARY_PATH
environment variable before trying to execute the application? – ParamagnetismlibAbcSupport.dylib
within the Mac's App so I don't need to modify the environment variables to get the App to run? (reposting comment so you'll get a notification and because I'm past the time limit for editing it) – Janes