From a548a522305152a8d732f95a4977928e487c5f57 Mon Sep 17 00:00:00 2001 From: Josef Angstenberger Date: Sat, 11 Jul 2020 16:19:09 +0200 Subject: Compiler/TI: Refactor C/CXX to use a common file --- Modules/Compiler/TI-C.cmake | 18 ++---------------- Modules/Compiler/TI-CXX.cmake | 17 ++--------------- Modules/Compiler/TI.cmake | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 31 deletions(-) create mode 100644 Modules/Compiler/TI.cmake diff --git a/Modules/Compiler/TI-C.cmake b/Modules/Compiler/TI-C.cmake index b060ee9..8ea01b5 100644 --- a/Modules/Compiler/TI-C.cmake +++ b/Modules/Compiler/TI-C.cmake @@ -1,22 +1,8 @@ -set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -set(CMAKE_LINK_LIBRARY_FLAG "--library=") -set(CMAKE_INCLUDE_FLAG_C "--include_path=") +include(Compiler/TI) +__compiler_ti(C) set(CMAKE_C90_STANDARD_COMPILE_OPTION "--c89") set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--c89 --relaxed_ansi") set(CMAKE_C99_STANDARD_COMPILE_OPTION "--c99") set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--c99 --relaxed_ansi") - -set(CMAKE_DEPFILE_FLAGS_C "--preproc_with_compile --preproc_dependency=") - -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --c_file= --output_file=") -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE " --preproc_only --c_file= --output_file=") - -set(CMAKE_C_COMPILE_OBJECT " --compile_only --c_file= --output_file=") -set(CMAKE_C_ARCHIVE_CREATE " qr ") -set(CMAKE_C_ARCHIVE_APPEND " qa ") -set(CMAKE_C_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") -set(CMAKE_ASM_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_C_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_C_RESPONSE_FILE_LINK_FLAG " ") diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake index 7836543..c08d9a1 100644 --- a/Modules/Compiler/TI-CXX.cmake +++ b/Modules/Compiler/TI-CXX.cmake @@ -1,15 +1,2 @@ -set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") -set(CMAKE_LINK_LIBRARY_FLAG "--library=") -set(CMAKE_INCLUDE_FLAG_CXX "--include_path=") - -set(CMAKE_DEPFILE_FLAGS_CXX "--preproc_with_compile --preproc_dependency=") - -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --cpp_file= --output_file=") -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE " --preproc_only --cpp_file= --output_file=") - -set(CMAKE_CXX_COMPILE_OBJECT " --compile_only --cpp_file= --output_file=") -set(CMAKE_CXX_ARCHIVE_CREATE " qr ") -set(CMAKE_CXX_ARCHIVE_APPEND " qa ") -set(CMAKE_CXX_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") -set(CMAKE_CXX_RESPONSE_FILE_FLAG "--cmd_file=") -set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG " ") +include(Compiler/TI) +__compiler_ti(CXX) diff --git a/Modules/Compiler/TI.cmake b/Modules/Compiler/TI.cmake new file mode 100644 index 0000000..5e1e1e6 --- /dev/null +++ b/Modules/Compiler/TI.cmake @@ -0,0 +1,35 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + + +# This module is shared by multiple languages; use include blocker. +if(__COMPILER_TI) + return() +endif() +set(__COMPILER_TI 1) + +macro(__compiler_ti lang) + string(TOLOWER ${lang} prefix) + if("x${lang}" STREQUAL "xCXX") + set(prefix "cpp") + endif() + + set(CMAKE_${lang}_RESPONSE_FILE_FLAG "--cmd_file=") + set(CMAKE_${lang}_RESPONSE_FILE_LINK_FLAG " ") + + set(CMAKE_INCLUDE_FLAG_${lang} "--include_path=") + set(CMAKE_DEPFILE_FLAGS_${lang} "--preproc_with_compile --preproc_dependency=") + + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE " --preproc_only --${prefix}_file= --output_file=") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE " --compile_only --skip_assembler --${prefix}_file= --output_file=") + + set(CMAKE_${lang}_COMPILE_OBJECT " --compile_only --${prefix}_file= --output_file=") + + set(CMAKE_${lang}_ARCHIVE_CREATE " qr ") + set(CMAKE_${lang}_ARCHIVE_APPEND " qa ") + + set(CMAKE_${lang}_LINK_EXECUTABLE " --run_linker --output_file= --map_file=.map ") +endmacro() + +set(CMAKE_LIBRARY_PATH_FLAG "--search_path=") +set(CMAKE_LINK_LIBRARY_FLAG "--library=") -- cgit v0.12