我们公司目前使用 CMake 来构建我们的 Windows 可执行文件。我正在努力使我们的应用程序在 Mac 上运行。到目前为止,该应用程序在 Mac 上构建良好。但是,当我尝试打开 CMake 为 Mac 创建的可执行文件时,我在终端窗口中收到以下错误:
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]
我认为该项目的 CMakeLists.txt 可能没有正确设置以构建 Mac 的可执行文件。我已将其包括在下面:
# 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()
有人可以让我知道我在上面的文件中遗漏了什么或有问题吗?如果这个文件不是问题,你能指出我正确的修复方向吗?