MantisBT - CMake
View Issue Details
0012614CMakeModulespublic2011-12-09 03:182016-06-10 14:31
Abdelrazak Younes 
Alex Neundorf 
normalfeatureN/A
closedmoved 
LinuxUbuntu11.10
CMake 2.8.5 
CMake 2.8.12 
0012614: Support for RVDS 4.1: ARM C/C++ and ASM compilers.
What works:

* The ASM compilation works just fine, except for <FLAGS>, we don’t know how to use that so we just hardcoded the flags in the CMakeASM-RVDSInformation.cmake file.

* The C and C++ compilation and static libraries generation work with one caveat: we hardcoded “armar” in CMAKE_C_CREATE_STATIC_LIBRARY and CMAKE_CXX_CREATE_STATIC_LIBRARY because setting CMAKE_AR doesn’t work for us.

What doesn’t work:

* We cannot use armcc for linking because we need to use a scatter file for memory and this requires using armlink. Unfortunately, setting CMAKE_CXX_LINK_EXECUTABLE doesn’t work for us because:
1) we did not find how to set the arguments of armlink correctly
2) armlink requires an object file as first input, giving only static libraries doesn’t work

So, as a workaround, we install our static libraries in a dedicated “archive” folder and we use a build script for the final linking step thanks to a custom target:

  file(GLOB archives ${CMAKE_BINARY_DIR}/archive/*.a)

  add_custom_target(fw ${CMAKE_SOURCE_DIR}/../cmake/link.sh ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}
                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/archive)

I also attach our build script for reference.

This works for us but obviously is far from optimal. So we are contributing this in the hope that it is useful to you and also that it can be improved. If some CMake developer can help us improve this, we would be happy to test and help of course.
Contribution of MARVELL Switzerland SARL
patch
zip cmake-RVDS.zip (2,475) 2011-12-09 03:18
https://public.kitware.com/Bug/file/4139/cmake-RVDS.zip
patch rvds-support.patch (3,526) 2012-01-16 08:25
https://public.kitware.com/Bug/file/4190/rvds-support.patch
txt 0001-ARM-compiler-RVDS-support.txt (8,829) 2012-12-21 04:51
https://public.kitware.com/Bug/file/4599/0001-ARM-compiler-RVDS-support.txt
txt 0001-ARM-compiler-RVDS-support_v2.txt (8,840) 2012-12-21 05:39
https://public.kitware.com/Bug/file/4600/0001-ARM-compiler-RVDS-support_v2.txt
txt 0001-ARM-compiler-RVDS-support_v3.txt (5,159) 2013-06-06 08:30
https://public.kitware.com/Bug/file/4780/0001-ARM-compiler-RVDS-support_v3.txt
Issue History
2011-12-09 03:18Abdelrazak YounesNew Issue
2011-12-09 03:18Abdelrazak YounesFile Added: cmake-RVDS.zip
2011-12-09 08:54Abdelrazak YounesNote Added: 0027937
2011-12-11 05:29Alex NeundorfNote Added: 0027939
2011-12-11 05:29Alex NeundorfNote Added: 0027940
2011-12-11 05:30Alex NeundorfNote Added: 0027941
2011-12-11 05:40Alex NeundorfNote Added: 0027942
2011-12-21 06:51Abdelrazak YounesNote Added: 0028026
2011-12-21 06:52Abdelrazak YounesTag Attached: patc
2011-12-21 06:53Abdelrazak YounesTag Detached: patc
2011-12-21 06:58Abdelrazak YounesNote Edited: 0028026bug_revision_view_page.php?bugnote_id=28026#r471
2011-12-21 07:03Abdelrazak YounesNote Added: 0028027
2012-01-06 16:22Alex NeundorfAssigned To => Alex Neundorf
2012-01-06 16:22Alex NeundorfStatusnew => assigned
2012-01-06 16:25Alex NeundorfNote Added: 0028210
2012-01-16 08:25Abdelrazak YounesFile Added: rvds-support.patch
2012-01-16 08:31Abdelrazak YounesNote Added: 0028312
2012-07-13 11:09Abdelrazak YounesNote Added: 0030046
2012-08-13 14:33Alex NeundorfTarget Version => CMake 2.8.10
2012-08-22 15:59Alex NeundorfNote Added: 0030737
2012-09-16 03:38Abdelrazak YounesNote Added: 0031033
2012-09-19 11:45Alex NeundorfNote Added: 0031063
2012-09-21 03:31Abdelrazak YounesNote Added: 0031078
2012-09-21 13:59Alex NeundorfNote Added: 0031082
2012-09-21 17:11Abdelrazak YounesNote Added: 0031083
2012-10-17 03:41Mats BengtssonNote Added: 0031252
2012-10-18 14:05Alex NeundorfNote Added: 0031277
2012-10-18 14:05Alex NeundorfTarget VersionCMake 2.8.10 => CMake 2.8.11
2012-10-19 05:23Mats BengtssonNote Added: 0031280
2012-11-04 11:17Alex NeundorfNote Added: 0031415
2012-11-04 11:22Alex NeundorfNote Added: 0031416
2012-11-05 03:53Mats BengtssonNote Added: 0031421
2012-11-05 04:04Abdelrazak YounesNote Added: 0031422
2012-11-20 11:30Eric FNote Added: 0031625
2012-12-20 04:58mcfriskNote Added: 0031929
2012-12-21 04:51mcfriskFile Added: 0001-ARM-compiler-RVDS-support.txt
2012-12-21 04:51mcfriskTag Attached: patch
2012-12-21 04:53mcfriskNote Added: 0031934
2012-12-21 05:19Abdelrazak YounesNote Added: 0031935
2012-12-21 05:39mcfriskFile Added: 0001-ARM-compiler-RVDS-support_v2.txt
2012-12-21 05:41mcfriskNote Added: 0031936
2013-05-17 09:33Robert MaynardTarget VersionCMake 2.8.11 => CMake 2.8.12
2013-06-06 08:30Benoit LaurentFile Added: 0001-ARM-compiler-RVDS-support_v3.txt
2013-06-06 08:31Benoit LaurentNote Added: 0033247
2014-02-16 09:36Abdelrazak YounesNote Added: 0035114
2014-02-16 14:07Alex NeundorfNote Added: 0035115
2014-02-16 20:23Abdelrazak YounesNote Added: 0035116
2014-10-02 03:57gerhardoNote Added: 0036885
2014-10-27 10:22gerhardoNote Added: 0037074
2014-10-28 08:17gerhardoNote Edited: 0037074bug_revision_view_page.php?bugnote_id=37074#r1596
2014-10-28 08:53gerhardoNote Edited: 0037074bug_revision_view_page.php?bugnote_id=37074#r1597
2015-07-10 12:26gerhardoNote Edited: 0036885bug_revision_view_page.php?bugnote_id=36885#r1845
2016-06-10 14:28Kitware RobotNote Added: 0041941
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0027937)
Abdelrazak Younes   
2011-12-09 08:54   
Patch to set a compiler ID for RVDS:

--- /usr/share/cmake-2.8/Modules/CMakeCCompilerId.c.in.original 2011-07-08 14:21:44.000000000 +0200
+++ /usr/share/cmake-2.8/Modules/CMakeCCompilerId.c.in 2011-12-09
+++ 09:57:49.565830358 +0100
@@ -85,6 +85,9 @@
 #elif defined(__hpux) || defined(__hpua) # define COMPILER_ID "HP"
 
+#elif defined(__ARMCC_VERSION)
+# define COMPILER_ID "RVDS"
+
 #else /* unknown compiler */
 # define COMPILER_ID ""
(0027939)
Alex Neundorf   
2011-12-11 05:29   
From the mailing list:

# Probably there is a macro builtin into this compiler to detect that it is the
# RVDS compiler ?

Yes, see here:

http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0041c/Babbacdb.html [^]

So I guess I can either use __arm or __ARMCC_VERSION
...
(0027940)
Alex Neundorf   
2011-12-11 05:29   
From the mailing list:
From: Abdelrazak Younes
> So now I will try to remove CMAKE_(C|CXX)_CREATE_* and ARCHIVE variables
> and modify Modules/CMakeFindBinUtils.cmake; I hope I can use a local copy
> for this file.

It seems I can use a local copy of it as I got a warning about that (see below). So I modified my local copy with the diff below but it doesn't work, /usr/bin/ar is still used. One additional question: armar is apparently doing the job of ar and ranlib so I don't want ranlib to be used afterwards so please tell me how to avoid that.
(0027941)
Alex Neundorf   
2011-12-11 05:30   
I suggest for getting the compiler support fully working just modify directly in the Modules/ directory what you need, and send the patches here.
(0027942)
Alex Neundorf   
2011-12-11 05:40   
The same patch you did for CMakeCCompilerId.c.in you also have to do for CXX, i.e. in CMakeCXXCompilerId.cpp.in, then also the compiler ID will be detected for C++.

CMAKE_LINKER is by default not really used anywhere, for most compilers simply the compiler is used for linking.

So, to get special behaviour for this toolchain, you should create the files Modules/Compiler/RVDS-C.cmake and RVDS-CXX.cmake.
Just put some message() in them so you they are loaded.

Once you see they are loaded, you can set the CMAKE_C_CREATE_STATIC_LIBRARY etc. variables in this file.
(0028026)
Abdelrazak Younes   
2011-12-21 06:51   
(edited on: 2011-12-21 06:58)
OK, Sorry for the delay. I managed to find time today to test your suggestions and the good news is it works!

I can now build and link a complete firmware.

I don't know how to attach a patch so I will just paste it here and send it also to the list (diff -r -u -N Modules.original Modules). This is the diff to support the C and C++ compilers and the customized linker. The ASM support is already done thanks to the modules attached to this issue.

diff -r -u -N Modules.original/CMakeCCompilerId.c.in Modules/CMakeCCompilerId.c.in
--- Modules.original/CMakeCCompilerId.c.in 2011-07-08 14:21:44.000000000 +0200
+++ Modules/CMakeCCompilerId.c.in 2011-12-09 09:57:49.565830358 +0100
@@ -85,6 +85,9 @@
 #elif defined(__hpux) || defined(__hpua)
 # define COMPILER_ID "HP"
 
+#elif defined(__ARMCC_VERSION)
+# define COMPILER_ID "RVDS"
+
 #else /* unknown compiler */
 # define COMPILER_ID ""
 
diff -r -u -N Modules.original/CMakeCXXCompilerId.cpp.in Modules/CMakeCXXCompilerId.cpp.in
--- Modules.original/CMakeCXXCompilerId.cpp.in 2011-12-21 10:22:00.401510651 +0100
+++ Modules/CMakeCXXCompilerId.cpp.in 2011-12-09 10:57:16.557647819 +0100
@@ -76,6 +76,9 @@
 #elif defined(__hpux) || defined(__hpua)
 # define COMPILER_ID "HP"
 
+#elif defined(__ARMCC_VERSION)
+# define COMPILER_ID "RVDS"
+
 #else /* unknown compiler */
 # define COMPILER_ID ""
 
diff -r -u -N Modules.original/CMakeFindBinUtils.cmake Modules/CMakeFindBinUtils.cmake
--- Modules.original/CMakeFindBinUtils.cmake 2011-12-09 10:21:21.365758108 +0100
+++ Modules/CMakeFindBinUtils.cmake 2011-12-21 09:22:34.473434853 +0100
@@ -38,8 +38,13 @@
 
   MARK_AS_ADVANCED(CMAKE_LINKER)
 
+ELSEIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "RVDS"
+ OR "${CMAKE_C_COMPILER_ID}" MATCHES "RVDS")
+
+ FIND_PROGRAM(CMAKE_AR NAMES armar HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
 # in all other cases search for ar, ranlib, etc.
 ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
    OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
    OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
 
diff -r -u -N Modules.original/Compiler/RVDS-C.cmake Modules/Compiler/RVDS-C.cmake
--- Modules.original/Compiler/RVDS-C.cmake 1970-01-01 01:00:00.000000000 +0100
+++ Modules/Compiler/RVDS-C.cmake 2011-12-21 12:21:24.133662924 +0100
@@ -0,0 +1,13 @@
+SET(CMAKE_C_FLAGS_INIT "")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "-Otime -DNDEBUG")
+SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+SET(CMAKE_C_COMPILER "armcc")
+SET(CMAKE_AR "armar")
+SET(CMAKE_LINKER "armlink")
+
+SET(CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> -r <LINK_FLAGS> <TARGET> <OBJECTS>")
+
+SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS>")
diff -r -u -N Modules.original/Compiler/RVDS-CXX.cmake Modules/Compiler/RVDS-CXX.cmake
--- Modules.original/Compiler/RVDS-CXX.cmake 1970-01-01 01:00:00.000000000 +0100
+++ Modules/Compiler/RVDS-CXX.cmake 2011-12-21 12:21:27.853663004 +0100
@@ -0,0 +1,13 @@
+SET(CMAKE_CXX_FLAGS_INIT "")
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
+SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Ospace -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "-Otime -DNDEBUG")
+SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+
+SET(CMAKE_CXX_COMPILER "armcc")
+SET(CMAKE_AR "armar")
+SET(CMAKE_LINKER "armlink")
+
+SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> -r <LINK_FLAGS> <TARGET> <OBJECTS>")
+
+SET(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_LINKER> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>")

(0028027)
Abdelrazak Younes   
2011-12-21 07:03   
I forgot to add that, ideally, I would like to get rid of the need to pass the toolchain file. We tried many things but did not succeed. At least we have now a simplified toolchain file that seems to be enough:

SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_SYSTEM_PROCESSOR arm)

SET(CMAKE_C_COMPILER armcc)
SET(CMAKE_CXX_COMPILER armcc)

Here is the result of cmake:

 cmake ../src -Drvds=1 -DCMAKE_TOOLCHAIN_FILE=../cmake/LinuxRvdsToolchain.cmake
-- The C compiler identification is RVDS
-- The CXX compiler identification is RVDS
-- Check for working C compiler: armcc
-- Check for working C compiler: armcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: armcc
-- Check for working CXX compiler: armcc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Compiling for ARM platform
-- The ASM-RVDS compiler identification is unknown
-- Found assembler: /opt/ARM/RVCT/Programs/4.1/462/linux-pentium/armasm
-- Configuring done
-- Generating done
-- Build files have been written to:
(0028210)
Alex Neundorf   
2012-01-06 16:25   
Yes, that simplified toolchain file looks how it should look :-)

Attaching a file here: quite at the top there is a line "Upload file", please use that to attach the patch. Makes it easier for me :-)

Thanks
Alex
(0028312)
Abdelrazak Younes   
2012-01-16 08:31   
Even if it still complains about unknown ASM-RVDS compiler identification. The attached patch (rvds-support.patch) works for us. It is against git master branch.

Please let me know if you need something else.

Thanks,
Abdel.
(0030046)
Abdelrazak Younes   
2012-07-13 11:09   
Any news on this? It would be nice to get it integrated in cmake...
(0030737)
Alex Neundorf   
2012-08-22 15:59   
Is this toolchain available for Linux, downloadable for free somewhere ?
(0031033)
Abdelrazak Younes   
2012-09-16 03:38   
Hi Alex, sorry for the delay.
I found this: https://www.keil.com/demo/eval/arm.htm [^]
(0031063)
Alex Neundorf   
2012-09-19 11:45   
Hmm, the software is available only for Windows...
(0031078)
Abdelrazak Younes   
2012-09-21 03:31   
indeed, but I can be the guinea pig for Linux...
(0031082)
Alex Neundorf   
2012-09-21 13:59   
How do you mean that ?
(0031083)
Abdelrazak Younes   
2012-09-21 17:11   
I run RVDS under Linux so, if you make modification of the RVDS support for Windows, I will make sure that your changes work for Linux as well.
(0031252)
Mats Bengtsson   
2012-10-17 03:41   
Hi Alex and Abdelrazak.

The ARM toolchain is available for both Windows and Linux. Download here;

https://silver.arm.com/browse/DS500 [^]

Yes, you have to register. Expand "ARM Compiler toolchain 5 (Linux)" on the right and download the latest, or expand "Display older versions" and download either of those. You should be able to download the exact same version and build number for Linux as you can get for Windows.

I have a similar need to what Abdelrazak has. I am doing a prestudy on using CMake at work, and support for the ARM toolchain on both Linux and Windows out of the box would be helpful.
(0031277)
Alex Neundorf   
2012-10-18 14:05   
It's a bit late for 2.8.10 now, but I'll work on this in the next days so it'll be in 2.8.11.
(0031280)
Mats Bengtsson   
2012-10-19 05:23   
One other thing, the ARM compiler will refuse to build anything unless there's a license for it. It will just scream if you specify a source file on the command line without a license file or a license server at the default locations, or specified with the LM_LICENSE_FILE environment variable.
(0031415)
Alex Neundorf   
2012-11-04 11:17   
I got it installed, but I'm missing a license.
Are there trial licenses or something similar available somewhere ?
(0031416)
Alex Neundorf   
2012-11-04 11:22   
I had a look at the patch.

Can you add the variables CMAKE_C/CXX_CREATE_ASSEMBLY_SOURCE and CMAKE_C/CXX_CREATE_PREPROCESSED_SOURCE , which are used when creating an assembly file or a preprocessed file respectively ?
(0031421)
Mats Bengtsson   
2012-11-05 03:53   
There's a "community edition" of the DS-5 product, but it does not appear to include the ARM compiler. Instead there seems to be some form of 30-day evaluation license available. I suggest you try that route. I am a bit unfamiliar with the FLEXlm license stuff though since it is all handled automatically in our systems.

http://www.arm.com/products/tools/software-tools/ds-5/ds-5-downloads.php [^]
(0031422)
Abdelrazak Younes   
2012-11-05 04:04   
We will try to add support for those variables. Could you please tell me in which file this has to go?
By the way, we have some fixes for the linker flags so I have to update the patch anyway.
About the license, as for Mats, unfortunately I cannot help you because our license are globally managed. We can try to write to ARM to see if they can provide you a license for CMake development purpose if you want.
(0031625)
Eric F   
2012-11-20 11:30   
Hi All,
just to confirm that with your patch, it works out of the box for me with RVCT.
it will be very nice indeed if in 2.811. No idea when this version will be roll out?
For the licence info, I just set the variable environment LM_LICENSE_FILE.

The patch I used is the content of rvds-support.patch file attached + the modification in CMakeFindBinUtils.cmake:
diff -rupN Modules.old/CMakeFindBinUtils.cmake Modules/CMakeFindBinUtils.cmake
--- Modules.old/CMakeFindBinUtils.cmake 2012-11-20 15:07:56.705072000 +0100
+++ Modules/CMakeFindBinUtils.cmake 2012-11-20 15:23:57.845108000 +0100
@@ -38,6 +38,12 @@ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "M
 
   MARK_AS_ADVANCED(CMAKE_LINKER)
 
+ELSEIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "RVDS"
+ OR "${CMAKE_C_COMPILER_ID}" MATCHES "RVDS")
+ FIND_PROGRAM(CMAKE_LINKER NAMES armar HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
+
+
+
 # in all other cases search for ar, ranlib, etc.


 ELSE("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC"
    OR "${CMAKE_C_COMPILER_ID}" MATCHES "MSVC"
(0031929)
mcfrisk   
2012-12-20 04:58   
Tested these RVDS patches in Windows with cmake 2.8.10.1 and evaluation version of RVDS 4.1:

https://public.kitware.com/Bug/file/4190/rvds-support.patch [^]
http://public.kitware.com/Bug/view.php?id=12614#c31625 [^]

Test project:

$ cat ../main.c
int main(void) {
return 0;
}

$ cat ../CMakeLists.txt
cmake_minimum_required (VERSION 2.8)
project (main)
add_executable(main main.c)

RVCT on Windows comes with GNU Make 3.81 so at least Unix Makefiles generator works:

$ cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=armcc -DCMAKE_C_COMPILER=armcc ..
-- The C compiler identification is RVDS
-- The CXX compiler identification is RVDS
-- Check for working C compiler: armcc
-- Check for working C compiler: armcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: armcc
-- Check for working CXX compiler: armcc -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/src/cmake/arm

$ make
Scanning dependencies of target main
[100%] Building C object CMakeFiles/main.dir/main.c.obj
Warning: C9931W: Your license for Compiler (feature compiler) will expire in 29 days

Warning: C9931W: Your license for Compiler (feature compiler) will expire in 29 days

Linking C executable main.exe
Warning: L9931W: Your license for Linker (feature armlink) will expire in 29 days

Finished: 0 information, 1 warning and 0 error messages.
[100%] Built target main

$ file main.exe
main.exe: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, not stripped

It seems CMake defaults to Visual Studio compiler with default windows generator even if another compiler is specified which feels odd:

> cmake -DCMAKE_C_COMPILER=armcc -DCMAKE_CXX_COMPILER=armcc ..
-- Building for: Visual Studio 10
-- The C compiler identification is MSVC 16.0.30319.1
-- The CXX compiler identification is MSVC 16.0.30319.1
-- Check for working C compiler using: Visual Studio 10
-- Check for working C compiler using: Visual Studio 10 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10
-- Check for working CXX compiler using: Visual Studio 10 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/src/cmake/nmake

Also what I find quite problematic is that toolchain files can not specify default C or CXX flags, like "--cpu=Cortex-A9 --fpmode=fast". I guess I would need to specify thees in every cmake lists file separately.
(0031934)
mcfrisk   
2012-12-21 04:53   
A cleaned up version of the patches attached. My changes are:

 * removed <FLAGS> from CMAKE_C_LINK_EXECUTABLE since linker does not understand
   compiler flags
 * allow C/CXX_FLAGS to be overridden via toolchain file
 * removed hardcoded ASM compiler flags
 * added mark_as_advanced(CMAKE_LINKER) to FindBinUtils
 * added CMAKE_C/CXX_CREATE_ASSEMBLY_SOURCE and CMAKE_C/CXX_CREATE_PREPROCESSED_SOURCE
(0031935)
Abdelrazak Younes   
2012-12-21 05:19   
Hi "mcfrisk",

I had a version of my patch that removed the hardcoded link option but it seems that I didn't send it.

Anyway, thanks for that and for the other improvments :-)

Abdel.
(0031936)
mcfrisk   
2012-12-21 05:41   
Uploaded v2 of the patch file where the From: line in commit message is removed. git am fails to apply the first one since From: does not have an email address.
(0033247)
Benoit Laurent   
2013-06-06 08:31   
Hi all,

I test the patch V2 on Window 7 Pro with CMake 2.8.10.1 and Keil ARM-MDK 4.70.

I use this toolchain file:
---
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_VERSION 1)

SET(CMAKE_C_COMPILER armcc)
SET(CMAKE_CXX_COMPILER armcc)

SET(CMAKE_FIND_ROOT_PATH C:/Keil/ARM/ARMCC)
SET(CMAKE_SYSTEM_INCLUDE_PATH /include )
SET(CMAKE_SYSTEM_LIBRARY_PATH /lib )
SET(CMAKE_SYSTEM_PROGRAM_PATH /bin )

SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET(CMAKE_C_FLAGS_INIT "--cpu=Cortex-M3")
SET(CMAKE_CXX_FLAGS_INIT "--cpu=Cortex-M3 --cpp")
---
I build 2 differents type of projects: executable and static lib.
The first project (executable) compile C and CXX file (test of armcc integration) and link the generated objects with external library and scatter file (test of armlink integration).
The second project (static lib) compile C/CXX file, ASM file (test of armasm integration) and generate a static lib (test of armar integration).
I have encountered some problems:
1 - RVDS-C/CXX.cmake override definition of CMAKE_C/CXX_COMPILER find by CMakeDetermineCCompiler.cmake and definition of CMAKE_AR and CMAKE_LINKER find by CMakeFindBinUtils.cmake so path is lost and compilation only work if you have toolchain path in the PATH.
2 - CMakeFindBinUtils.cmake set CMAKE_LINKER with armar instead of armlink.
3 - CMAKE_AR is not defined so generation of static lib doesn't work.
4 - CMAKE_C_CREATE_STATIC_LIBRARY use -r option for creation of lib. I think --create option is safer. If a lib file already exist, --create option replace it while -r option add object to the existing one.
5 - RVDS ASM supprot only .s and .asm extension and not .S.

I upload v3 of the patch file with the correction.

Best regards.
(0035114)
Abdelrazak Younes   
2014-02-16 09:36   
Dear Cmake maintainers,

I contributed the first version of this patch 3 years ago; the patch has been tested and improved on multiple platforms by at least 3 others contributors I don't personally know. My team is using it since then without any issue.

Don't you think it's stable enough to be applied into your master branch for the next release?

Please understand that it is really cumbersome to maintain a cmake build just for this small and simple patch.

Thanks in advance and best regards,
Abdel.
(0035115)
Alex Neundorf   
2014-02-16 14:07   
Hi Abdel,

I'm doing that in my spare time, and due to familiar reasons :-) I'm very short of that currently.
But I haven't forgotten this ticket.

Alex
(0035116)
Abdelrazak Younes   
2014-02-16 20:23   
Thanks Alex. If you do this in your spare time you have all rights to take your time and to enjoy your family :-)

Abdel.
(0036885)
gerhardo   
2014-10-02 03:57   
(edited on: 2015-07-10 12:26)
I miss the following, for response files:
SET( CMAKE_C_RESPONSE_FILE_LINK_FLAG "--via=" )

armcc do not handle the standard "@" to include files
(I have not tested the patch myself yet, CMAKE_C_LINK_EXECUTABLE work for me.)

Related, not in this patch I believe:
Note if you are using armcc as the linker, this configuration will fail if the response file is larger than about 32767 bytes.
It seems like armss handles the contents in an internal buffer before transfering to armcc. The following configuration should be used.

SET( CMAKE_C_RESPONSE_FILE_LINK_FLAG "-L--via=" )

(0037074)
gerhardo   
2014-10-27 10:22   
(edited on: 2014-10-28 08:53)
A few more findings for CMake and primarily Ninja on the maillist:
http://www.cmake.org/pipermail/cmake/2014-October/058963.html [^]

1. Error Log handling is in the user configuration

2. DEP file handling support
ARMCC config can be adapted (despite first finding on the mailinglist) (ASM untested):
    SET( CMAKE_DEPFILE_FLAGS_C "--depend=<OBJECT>.d --depend_format=unix" )
    SET( CMAKE_DEPFILE_FLAGS_ASM "--depend=<OBJECT>.d --depend_format=unix" )


Edit: RVDS is now known as DS-5, it is likely better to rename the addition to ARMCC

(0041941)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.