summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-03-08 19:22:38 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-03-08 19:22:38 (GMT)
commit036aab093b30e3305e1eef66b9fba7317c2af600 (patch)
treeacdb116deb07cc2376f2ef748f653c1ef6f2de9c
parent831fef8167cfdcc86dfb838f60ef9dd5ba864a72 (diff)
parentb3ce4200dca9903e9ac56f6924aa4cc349aa0f7a (diff)
downloadCMake-036aab093b30e3305e1eef66b9fba7317c2af600.zip
CMake-036aab093b30e3305e1eef66b9fba7317c2af600.tar.gz
CMake-036aab093b30e3305e1eef66b9fba7317c2af600.tar.bz2
Merge topic 'ReworkedAsmSupport'
b3ce420 Do not bother enabling C++ in Assembler test 80f6a34 Teach Assembler test to generate main.s at build time 1dafa74 Fix Assembler test to parse C flags string before using 4139a73 -only enable the asm test for the Intel compiler if we are under UNIX 1f6c6b1 -use CMAKE_C_FLAGS when generating the assembler file d0f71e2 Add ASM platform information for HP compiler on HP bd580be Merge branch 'hp-compiler-info' into ReworkedAsmSupport a0bab7a Add ASM platform information for XL compiler on AIX c03b610 Merge branch 'aix-xl-platform-info' into ReworkedAsmSupport c623008 Initialize ASM rpath flags for executables with those for shared libs 17c658f Add support for the Intel compiler used for ASM under Windows 4258b24 Add more regex for gcc, always print the ASM compiler ID 9071b8b Add temporary debug output for compiler ID detection for ASM 48f7199 It's ELSEIF(), not ELSIF() d103c75 Fix bad comparison in the detect assembler-code 20fe0be Only try assembler support for Makefile-based generators 8614470 Use a regexp instead a lot of ORs for checking the compiler ID cf88092 The Assembler test now tests ASM for GNU, Intel, HP, XL and SunPro 66614a8 Add assemble- and preprocess commands for HP 78f7c59 Fix the default CMAKE_ASM_COMPILE_OBJECT, make XL-ASM use it 7456461 Change the default rules so they fit better to the new ASM handling 5542d58 Set the HP asm file suffix f745220 Add support for ASm for the HP compiler. 00735d4 Add suport for ASM for the IBM XL compiler d3e9e8a Add support for ASM for the SunPro compiler 64e66eb Actually use CMAKE_ASM_COMPILER for asm, instead of CMAKE_C_COMPILER 38f92bf Add ASM support for the Intel compiler 4b40d42 Rework the way assembler is handled, use the C/CXX compiler by default
-rw-r--r--Modules/CMakeASM-ATTInformation.cmake3
-rw-r--r--Modules/CMakeASMCompiler.cmake.in1
-rw-r--r--Modules/CMakeASMInformation.cmake21
-rw-r--r--Modules/CMakeDetermineASMCompiler.cmake86
-rw-r--r--Modules/CMakeDetermineCompilerId.cmake7
-rw-r--r--Modules/Compiler/GNU-ASM.cmake6
-rw-r--r--Modules/Compiler/HP-ASM.cmake3
-rw-r--r--Modules/Compiler/HP-C.cmake3
-rw-r--r--Modules/Compiler/HP-CXX.cmake3
-rw-r--r--Modules/Compiler/Intel-ASM.cmake13
-rw-r--r--Modules/Compiler/SunPro-ASM.cmake24
-rw-r--r--Modules/Compiler/XL-ASM.cmake13
-rw-r--r--Modules/Platform/AIX-XL-ASM.cmake2
-rw-r--r--Modules/Platform/HP-UX-HP-ASM.cmake6
-rw-r--r--Modules/Platform/HP-UX-HP.cmake1
-rw-r--r--Modules/Platform/Windows-Intel-ASM.cmake2
-rw-r--r--Tests/Assembler/CMakeLists.txt40
17 files changed, 200 insertions, 34 deletions
diff --git a/Modules/CMakeASM-ATTInformation.cmake b/Modules/CMakeASM-ATTInformation.cmake
index abf560b..cb1f5d6 100644
--- a/Modules/CMakeASM-ATTInformation.cmake
+++ b/Modules/CMakeASM-ATTInformation.cmake
@@ -18,5 +18,8 @@ SET(ASM_DIALECT "-ATT")
# *.S files are supposed to be preprocessed, so they should not be passed to
# assembler but should be processed by gcc
SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;asm)
+
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
+
INCLUDE(CMakeASMInformation)
SET(ASM_DIALECT)
diff --git a/Modules/CMakeASMCompiler.cmake.in b/Modules/CMakeASMCompiler.cmake.in
index 230805b..2dc24b0 100644
--- a/Modules/CMakeASMCompiler.cmake.in
+++ b/Modules/CMakeASMCompiler.cmake.in
@@ -4,6 +4,7 @@ SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_LINKER "@CMAKE_LINKER@")
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_LOADED 1)
+SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ID "@_CMAKE_ASM_COMPILER_ID@")
SET(CMAKE_ASM@ASM_DIALECT@_COMPILER_ENV_VAR "@_CMAKE_ASM_COMPILER_ENV_VAR@")
SET(CMAKE_ASM@ASM_DIALECT@_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index b94303e..d50f351 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -12,8 +12,6 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
-MESSAGE(STATUS "Loaded CMakeASM${ASM_DIALECT}Information - ASM${ASM_DIALECT} support is still experimental, please report issues")
-
IF(UNIX)
SET(CMAKE_ASM${ASM_DIALECT}_OUTPUT_EXTENSION .o)
ELSE(UNIX)
@@ -34,6 +32,9 @@ IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
INCLUDE(Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT} OPTIONAL RESULT_VARIABLE _INCLUDED_FILE)
ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
IF(NOT _INCLUDED_FILE)
+ IF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+ MESSAGE(FATAL_ERROR "Did not find file Compiler/${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}-ASM${ASM_DIALECT}")
+ ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
INCLUDE(Platform/${CMAKE_BASE_NAME} OPTIONAL)
ENDIF(NOT _INCLUDED_FILE)
@@ -89,7 +90,7 @@ MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_FLAGS
IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
- SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> -o <OBJECT> <SOURCE>")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT)
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
@@ -100,9 +101,21 @@ ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_STATIC_LIBRARY)
IF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
SET(CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE
- "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+ "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_LINK_EXECUTABLE)
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG)
+ SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG})
+ENDIF()
+
+IF(NOT CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP)
+ SET(CMAKE_EXECUTABLE_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_ASM${ASM_DIALECT}_FLAG_SEP})
+ENDIF()
+
+IF(NOT CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG)
+ SET(CMAKE_EXECUTABLE_RPATH_LINK_ASM${ASM_DIALECT}_FLAG ${CMAKE_SHARED_LIBRARY_RPATH_LINK_ASM${ASM_DIALECT}_FLAG})
+ENDIF()
+
# to be done
IF(NOT CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
SET(CMAKE_ASM${ASM_DIALECT}_CREATE_SHARED_LIBRARY)
diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake
index d6350bf..171e31f 100644
--- a/Modules/CMakeDetermineASMCompiler.cmake
+++ b/Modules/CMakeDetermineASMCompiler.cmake
@@ -21,11 +21,37 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER)
ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+")
# finally list compilers to try
- IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
- SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
- ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
- SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}as ${_CMAKE_TOOLCHAIN_PREFIX}gas)
- ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+ IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support
+
+ IF(CMAKE_ASM_COMPILER_INIT)
+ SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT})
+ ELSE(CMAKE_ASM_COMPILER_INIT)
+
+ IF(CMAKE_C_COMPILER)
+ SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler")
+ SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}")
+ ELSEIF(CMAKE_CXX_COMPILER)
+ SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler")
+ SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}")
+ ELSE(CMAKE_CXX_COMPILER)
+ # List all default C and CXX compilers
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc
+ ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC)
+ ENDIF(CMAKE_C_COMPILER)
+
+ ENDIF(CMAKE_ASM_COMPILER_INIT)
+
+
+ ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect"
+
+ IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT})
+ ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+ MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !")
+ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT)
+
+ ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM")
+
# Find the compiler.
IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH)
@@ -63,7 +89,24 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
# Table of per-vendor compiler id flags with expected output.
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU )
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version")
- SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "GNU assembler")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C")
+
+ LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL )
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion")
+ SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C")
+
LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP )
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h")
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments")
@@ -71,14 +114,15 @@ IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
INCLUDE(CMakeDetermineCompilerId)
CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT})
- IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
- MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
- ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
- MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
- ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
-
ENDIF()
+IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
+ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+ MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown")
+ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID)
+
+
# If we have a gas/as cross compiler, they have usually some prefix, like
# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally
@@ -90,10 +134,25 @@ ENDIF()
IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME)
IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
- STRING(REGEX REPLACE "^(.+-)g?as(\\.exe)?$" "\\1" _CMAKE_TOOLCHAIN_PREFIX "${COMPILER_BASENAME}")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+# Now try the C compiler regexp:
+IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+# Finally try the CXX compiler regexp:
+IF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+ IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
+ ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
+ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX)
+
+
INCLUDE(CMakeFindBinUtils)
SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}")
@@ -106,6 +165,7 @@ ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER)
SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}")
+SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}")
SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}")
SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 9a3884a..b160dee 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -287,6 +287,13 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang)
RESULT_VARIABLE result
TIMEOUT 10
)
+
+ IF("${lang}" STREQUAL "ASM")
+ MESSAGE(STATUS "Checked for ${vendor}")
+ MESSAGE(STATUS " Output: -${output}-")
+ MESSAGE(STATUS " Result: -${result}-")
+ ENDIF("${lang}" STREQUAL "ASM")
+
IF("${output}" MATCHES "${regex}")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" "
diff --git a/Modules/Compiler/GNU-ASM.cmake b/Modules/Compiler/GNU-ASM.cmake
new file mode 100644
index 0000000..e07401d
--- /dev/null
+++ b/Modules/Compiler/GNU-ASM.cmake
@@ -0,0 +1,6 @@
+# This file is loaded when gcc/g++ is used for assembler files (the "ASM" cmake language)
+include(Compiler/GNU)
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S;asm)
+
+__compiler_gnu(ASM)
diff --git a/Modules/Compiler/HP-ASM.cmake b/Modules/Compiler/HP-ASM.cmake
new file mode 100644
index 0000000..8aa7bdb
--- /dev/null
+++ b/Modules/Compiler/HP-ASM.cmake
@@ -0,0 +1,3 @@
+SET(CMAKE_ASM_VERBOSE_FLAG "-v")
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
diff --git a/Modules/Compiler/HP-C.cmake b/Modules/Compiler/HP-C.cmake
index abf384a..dc7fbb2 100644
--- a/Modules/Compiler/HP-C.cmake
+++ b/Modules/Compiler/HP-C.cmake
@@ -1 +1,4 @@
SET(CMAKE_C_VERBOSE_FLAG "-v")
+
+SET(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+SET(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/HP-CXX.cmake b/Modules/Compiler/HP-CXX.cmake
index f3c6b5f..82c1a86 100644
--- a/Modules/Compiler/HP-CXX.cmake
+++ b/Modules/Compiler/HP-CXX.cmake
@@ -1 +1,4 @@
SET(CMAKE_CXX_VERBOSE_FLAG "-v")
+
+SET(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
+SET(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
diff --git a/Modules/Compiler/Intel-ASM.cmake b/Modules/Compiler/Intel-ASM.cmake
new file mode 100644
index 0000000..59b50a1
--- /dev/null
+++ b/Modules/Compiler/Intel-ASM.cmake
@@ -0,0 +1,13 @@
+SET(CMAKE_ASM_VERBOSE_FLAG "-v")
+
+SET(CMAKE_ASM_FLAGS_INIT "")
+SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+IF(UNIX)
+ SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S)
+ELSE(UNIX)
+ SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm)
+ENDIF(UNIX)
diff --git a/Modules/Compiler/SunPro-ASM.cmake b/Modules/Compiler/SunPro-ASM.cmake
new file mode 100644
index 0000000..dfc5702
--- /dev/null
+++ b/Modules/Compiler/SunPro-ASM.cmake
@@ -0,0 +1,24 @@
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
+
+SET(CMAKE_ASM_VERBOSE_FLAG "-#")
+
+SET(CMAKE_SHARED_LIBRARY_ASM_FLAGS "-KPIC")
+SET(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-G")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG "-R")
+SET(CMAKE_SHARED_LIBRARY_RUNTIME_ASM_FLAG_SEP ":")
+SET(CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG "-h")
+
+SET(CMAKE_ASM_FLAGS_INIT "")
+SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g -xO2")
+
+# Initialize ASM link type selection flags. These flags are used when
+# building a shared library, shared module, or executable that links
+# to other libraries to select whether to use the static or shared
+# versions of the libraries.
+FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
+ SET(CMAKE_${type}_LINK_STATIC_ASM_FLAGS "-Bstatic")
+ SET(CMAKE_${type}_LINK_DYNAMIC_ASM_FLAGS "-Bdynamic")
+ENDFOREACH(type)
diff --git a/Modules/Compiler/XL-ASM.cmake b/Modules/Compiler/XL-ASM.cmake
new file mode 100644
index 0000000..e5d4ffa
--- /dev/null
+++ b/Modules/Compiler/XL-ASM.cmake
@@ -0,0 +1,13 @@
+SET(CMAKE_ASM_VERBOSE_FLAG "-V")
+
+# -qthreaded = Ensures that all optimizations will be thread-safe
+# -qalias=noansi = Turns off type-based aliasing completely (safer optimizer)
+# -qhalt=e = Halt on error messages (rather than just severe errors)
+SET(CMAKE_ASM_FLAGS_INIT "-qthreaded -qalias=noansi -qhalt=e -qsourcetype=assembler")
+
+SET(CMAKE_ASM_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_ASM_FLAGS_RELEASE_INIT "-O -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_MINSIZEREL_INIT "-O -DNDEBUG")
+SET(CMAKE_ASM_FLAGS_RELWITHDEBINFO_INIT "-g")
+
+SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s )
diff --git a/Modules/Platform/AIX-XL-ASM.cmake b/Modules/Platform/AIX-XL-ASM.cmake
new file mode 100644
index 0000000..ea0944b
--- /dev/null
+++ b/Modules/Platform/AIX-XL-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/AIX-XL)
+__aix_compiler_xl(ASM)
diff --git a/Modules/Platform/HP-UX-HP-ASM.cmake b/Modules/Platform/HP-UX-HP-ASM.cmake
new file mode 100644
index 0000000..0a85905
--- /dev/null
+++ b/Modules/Platform/HP-UX-HP-ASM.cmake
@@ -0,0 +1,6 @@
+include(Platform/HP-UX-HP)
+__hpux_compiler_hp(ASM)
+
+set(CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS "-E -b +nodefaultrpath -L/usr/lib")
+
+set(CMAKE_ASM_CREATE_SHARED_LIBRARY "ld <CMAKE_SHARED_LIBRARY_CREATE_ASM_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_ASM_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
diff --git a/Modules/Platform/HP-UX-HP.cmake b/Modules/Platform/HP-UX-HP.cmake
index 772edb4..5e70d31 100644
--- a/Modules/Platform/HP-UX-HP.cmake
+++ b/Modules/Platform/HP-UX-HP.cmake
@@ -20,6 +20,7 @@ set(__HPUX_COMPILER_HP 1)
set(_Wl_C "")
set(_Wl_CXX "-Wl,")
set(_Wl_Fortran "")
+set(_Wl_ASM "")
macro(__hpux_compiler_hp lang)
set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "+Z")
diff --git a/Modules/Platform/Windows-Intel-ASM.cmake b/Modules/Platform/Windows-Intel-ASM.cmake
new file mode 100644
index 0000000..31d08c7
--- /dev/null
+++ b/Modules/Platform/Windows-Intel-ASM.cmake
@@ -0,0 +1,2 @@
+include(Platform/Windows-Intel)
+__windows_compiler_intel(ASM)
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt
index b2937bb..ad27e57 100644
--- a/Tests/Assembler/CMakeLists.txt
+++ b/Tests/Assembler/CMakeLists.txt
@@ -1,26 +1,32 @@
cmake_minimum_required (VERSION 2.6)
-project(Assembler)
+project(Assembler C)
+message("CTEST_FULL_OUTPUT ")
+set(CMAKE_VERBOSE_MAKEFILE 1)
set(SRCS)
-# if no file has been set as source and we are on linux with an x86 processor try to use the gas/as assembler
-# main-linux-x86-gas.s seems to work for Linux and FreeBSD
-if(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
- if(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
- message(STATUS "Trying to enable ASM-ATT for Linux or FreeBSD on x86")
- enable_language(ASM-ATT OPTIONAL)
- if(CMAKE_ASM-ATT_COMPILER_WORKS)
- message(STATUS "Trying to enable ASM-ATT for Linux/x86 - succeeded")
- # this assembler file was created using gcc -S main.c
- set(SRCS main-linux-x86-gas.s)
- endif(CMAKE_ASM-ATT_COMPILER_WORKS)
- endif(CMAKE_SYSTEM MATCHES Linux OR CMAKE_SYSTEM MATCHES FreeBSD)
-endif(NOT SRCS AND CMAKE_SYSTEM_PROCESSOR MATCHES "[ix].?86$")
+# (at least) the following toolchains can process assembler files directly
+# and also generate assembler files from C:
+if("${CMAKE_GENERATOR}" MATCHES "Makefile")
+ if(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
+ set(C_FLAGS "${CMAKE_C_FLAGS}")
+ separate_arguments(C_FLAGS)
+ set(SRCS main.s)
+ add_custom_command(
+ OUTPUT main.s
+ COMMAND ${CMAKE_C_COMPILER} ${C_FLAGS} -S ${CMAKE_CURRENT_SOURCE_DIR}/main.c -o main.s
+ DEPENDS main.c
+ VERBATIM
+ )
+ endif(("${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|HP|SunPro|XL)$") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Intel" AND UNIX))
+endif("${CMAKE_GENERATOR}" MATCHES "Makefile")
-if(NOT SRCS)
+
+if(SRCS)
+ enable_language(ASM OPTIONAL)
+else(SRCS)
message(STATUS "No assembler enabled, using C")
set(SRCS main.c)
-endif(NOT SRCS)
+endif(SRCS)
add_executable(HelloAsm ${SRCS})
-set_target_properties(HelloAsm PROPERTIES LINKER_LANGUAGE C)