我正试图为一个名为TMPx的商品64/6502跨汇编程序建立一个尽可能可重用的cmake构建系统。
我的问题是:
tmpx尝试在不同的指定位置(取决于主机平台)检测和设置 TMPx.exe 或TMPx.exe可执行和正确路径? ./cmake/模块中的哪一个是这样的搜索/查找呢?
cmake . 检测并列出TMPX版本,而不是显示:-- ASM_TMPX编译器标识未知除此之外,其他的建议和建议也受到了极大的赞赏。
(这是我的https://bitbucket.org/duckhuntpr0/cmake-c64-tmpx/和下面的文件)
我的./CMakeLists.txt
CMAKE_MINIMUM_REQUIRED(VERSION 3.14)
set(CMAKE_SYSTEM_NAME "C64")
set(CMAKE_SYSTEM_PROCESSOR 6502)
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}/cmake")
#TODO: Try to move this into one of the cmake/ modules..
SET(CMAKE_ASM_TMPX_COMPILER "${CMAKE_BINARY_DIR}/tools/TMPx_v1.1.0-STYLE/linux-x86_64/tmpx")
PROJECT(test001 ASM_TMPX)通过遵循这是来自CMake维基的指南,到目前为止,我已经得到了以下接近完成和半工作的cmake模块:
./cmake/CMakeASM_TMPXInformation.cmake
SET(ASM_DIALECT "_TMPX")
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS ms;s;asm)
#Set any default arguments here
#TODO: remove the nasm args
IF(UNIX)
SET(CMAKE_ASM_TMPX_COMPILER_ARG1 "-f elf")
ELSE(UNIX)
SET(CMAKE_ASM_TMPX_COMPILER_ARG1 "-f win32")
ENDIF(UNIX)
# This section exists to override the one in CMakeASMInformation.cmake
# (the default Information file). This removes the <FLAGS>
# thing so that your C compiler flags that have been set via
# set_target_properties don't get passed to TMPx and confuse it.
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
#TODO: Change nasm args to correct tmpx arguments
SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> -o <OBJECT> <SOURCE>")
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
INCLUDE(CMakeASMInformation)
SET(ASM_DIALECT)./cmake/CMakeDetermineASM_TMPXCompiler.cmake
SET(ASM_DIALECT "_TMPX")
IF(UNIX)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}tmpx)
ENDIF()
# TODO: Properly determine exen for other host platforms
# (The Windows exe would be 'TMPx.exe' but possibly 'tmpx.exe' or 'TMPX.EXE')
INCLUDE(CMakeDetermineASMCompiler)
SET(ASM_DIALECT)./cmake/CMakeTestASM_TMPXCompiler.cmake
###
# From original template:
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that the selected ASM-ATT "compiler" works.
# For assembler this can only check whether the compiler has been found,
# because otherwise there would have to be a separate assembler source file
# for each assembler on every architecture.
###
set(ASM_DIALECT "_TMPX")
include(CMakeTestASMCompiler)
set(ASM_DIALECT)./cmake/Platform/C64.cmake
MESSAGE("-¤# Building for Commodore 64 platform! #¤-")
#this does not seem to work
#SET(CMAKE_ASM_TMPX_COMPILER "${CMAKE_BINARY_DIR}/tools/TMPx_v1.1.0-STYLE/linux-x86_64/tmpx")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)发布于 2019-06-30 01:36:25
在使用cmake的'MESSAGE()‘命令仔细检查之后,我认为我至少已经得到了第一个问题的答案;./cmake/CMakeDetermineASM_TMPXCompiler.cmake是第一个要运行的东西(并且只在第一个'cmake’)运行。什么时候
PROJECT(test001 ASM_TMPX) #asm_tmpx denoting the <lang>_<dialect>在./CMakeLists.txt中设置。
在我的例子中,'cmake .‘的运行命令。似乎是:
因此,我猜想,在CMakeDetermineLANG_DIALECTCompiler.cmake中,任何和所有对汇编程序可执行文件位置的检测,以及对汇编程序版本的任何提取、命令行参数等等,都可以并且需要执行。
https://stackoverflow.com/questions/56819311
复制相似问题