我怎么能通过cmake执行exe(Qt3的uic)
How could I execute the exe(uic of Qt3) by cmake
我正在尝试调用 Qt3 的 uic(维护遗留代码),但失败了 so.Following 是我的 make 文件
project(testQt3)
cmake_minimum_required(VERSION 2.8.11)
set(PROJECT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../project)
set(PROJECT_ARCH $ENV{MAKEOBJDIR})
set(CMAKE_BUILD_TYPE Release)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(Qt3DirPath ${PROJECT_PATH}/qt/${PROJECT_ARCH})
set(Qt3LibPath ${Qt3DirPath}/lib)
set(Qt3Libs ${Qt3LibPath}/qt-mt338.lib ${Qt3LibPath}/qtmain.lib)
add_custom_command(TARGET uic.exe
PRE_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../data/import_card_info.ui -o ${CMAKE_CURRENT_SOURCE_DIR}/../incl/import_card_info_ui.h
WORKING_DIRECTORY ${Qt3DirPath}/bin
)
target_link_libraries(${PROJECT_NAME} ${Qt3Libs})
当我 运行 cmake(点击 cmake gui 上的配置按钮)时,它给我消息
CMake Warning (dev) at src/CMakeLists.txt:21 (add_custom_command):
Policy CMP0040 is not set: The target in the TARGET signature of
add_custom_command() must exist. Run "cmake --help-policy CMP0040"
for policy details. Use the cmake_policy command to set the policy
and suppress this warning.
The target name "uic.exe" is unknown in this context. This warning
is for project developers. Use -Wno-dev to suppress it.
如何让 uic.exe 通过 cmake 为我生成 ui 文件?
ps :
find_package 命令无法工作,这就是为什么我想编写一个简单的函数来为我生成 ui 和 moc 文件。我尝试设置 CMAKE_PREFIX_PATH,但它也不起作用
#set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${Qt3Dir}")
我唯一想到的是 cmake 无法找到 uic.exe
首先尝试使用完整路径。如果有效,请返回 "uic.exe" 并尝试将其位置添加到 linux 相当于 cmake 的 PATH。
我找到原因了,cmake要生成一个makefile,会调用set_custom_target的exe设置,我必须添加一个命令
add_dependencies(${PROJECT_NAME} uic)
我正在尝试调用 Qt3 的 uic(维护遗留代码),但失败了 so.Following 是我的 make 文件
project(testQt3)
cmake_minimum_required(VERSION 2.8.11)
set(PROJECT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../project)
set(PROJECT_ARCH $ENV{MAKEOBJDIR})
set(CMAKE_BUILD_TYPE Release)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
set(Qt3DirPath ${PROJECT_PATH}/qt/${PROJECT_ARCH})
set(Qt3LibPath ${Qt3DirPath}/lib)
set(Qt3Libs ${Qt3LibPath}/qt-mt338.lib ${Qt3LibPath}/qtmain.lib)
add_custom_command(TARGET uic.exe
PRE_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/../data/import_card_info.ui -o ${CMAKE_CURRENT_SOURCE_DIR}/../incl/import_card_info_ui.h
WORKING_DIRECTORY ${Qt3DirPath}/bin
)
target_link_libraries(${PROJECT_NAME} ${Qt3Libs})
当我 运行 cmake(点击 cmake gui 上的配置按钮)时,它给我消息
CMake Warning (dev) at src/CMakeLists.txt:21 (add_custom_command):
Policy CMP0040 is not set: The target in the TARGET signature of
add_custom_command() must exist. Run "cmake --help-policy CMP0040" for policy details. Use the cmake_policy command to set the policy and suppress this warning.The target name "uic.exe" is unknown in this context. This warning is for project developers. Use -Wno-dev to suppress it.
如何让 uic.exe 通过 cmake 为我生成 ui 文件?
ps : find_package 命令无法工作,这就是为什么我想编写一个简单的函数来为我生成 ui 和 moc 文件。我尝试设置 CMAKE_PREFIX_PATH,但它也不起作用
#set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${Qt3Dir}")
我唯一想到的是 cmake 无法找到 uic.exe
首先尝试使用完整路径。如果有效,请返回 "uic.exe" 并尝试将其位置添加到 linux 相当于 cmake 的 PATH。
我找到原因了,cmake要生成一个makefile,会调用set_custom_target的exe设置,我必须添加一个命令
add_dependencies(${PROJECT_NAME} uic)