diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake index c49581023..0fad25df7 100644 --- a/Modules/CMakeASMInformation.cmake +++ b/Modules/CMakeASMInformation.cmake @@ -42,10 +42,45 @@ IF(NOT _INCLUDED_FILE) INCLUDE(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_C_COMPILER_ID}-ASM OPTIONAL) ENDIF(NOT _INCLUDED_FILE) +# Set default assembler file extensions: IF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm) ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS) + +# Support for CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT and friends: +SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT "$ENV{ASM${ASM_DIALECT}FLAGS} ${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}") +# avoid just having a space as the initial value for the cache +IF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") + SET(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT) +ENDIF(CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT STREQUAL " ") +SET (CMAKE_ASM${ASM_DIALECT}_FLAGS "${CMAKE_ASM${ASM_DIALECT}_FLAGS_INIT}" CACHE STRING + "Flags used by the assembler during all build types.") + +IF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) +# default build type is none + IF(NOT CMAKE_NO_BUILD_TYPE) + SET (CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE_INIT} CACHE STRING + "Choose the type of build, options are: None, Debug Release RelWithDebInfo MinSizeRel.") + ENDIF(NOT CMAKE_NO_BUILD_TYPE) + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG "${CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG_INIT}" CACHE STRING + "Flags used by the assembler during debug builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL "${CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL_INIT}" CACHE STRING + "Flags used by the assembler during release minsize builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE_INIT}" CACHE STRING + "Flags used by the assembler during release builds.") + SET (CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO "${CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING + "Flags used by the assembler during Release with Debug Info builds.") +ENDIF(NOT CMAKE_NOT_USING_CONFIG_FLAGS) + +MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS + CMAKE_ASM${ASM_DIALECT}_FLAGS_DEBUG + CMAKE_ASM${ASM_DIALECT}_FLAGS_MINSIZEREL + CMAKE_ASM${ASM_DIALECT}_FLAGS_RELEASE + CMAKE_ASM${ASM_DIALECT}_FLAGS_RELWITHDEBINFO + ) + + IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT) SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT " -o ") ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)