Hi I'm trying to use -ffunction-sections -fdata-sections as C_FLAGS and -Wl,--gc- sections when cross-compiling for my ARM Linux target.
The gc-sections option does not work because CMake adds the "-rdynamic" flag which exports all symbols, also the unused ones. I already figured out that I can suppress this be setting set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") This work is the CMakeLists.txt files, but it does not work from a toolchain file. But I want to configure this in my toolchain file, because this setting is specific for this single target. It is not an option add this as generic setting for all targets. I also tried this: set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "" CACHE INTERNAL "" FORCE) But this does not work either. I believe this is a problem of the order how CMake files are processed. It looks like the toolchain file is processed first and then /usr/share/cmake/Modules/Platform/Linux-GNU.cmake which overwrites the toolchain settings (just a guess) BTW: I had similar problems with settings CMAKE_C_FLAGS, etc. from the toochain file. # this does not work SET(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99 -fdata-sections -ffunction- sections") # with CACHE FORCE it does work SET(CMAKE_C_FLAGS "-Wall -Wextra -std=gnu99 -fdata-sections -ffunction- sections" CACHE INTERNAL "c compiler flags" FORCE) I'm not sure if this was intended. And for CMAKE_SHARED_LIBRARY_LINK_C_FLAGS this does not work either, as explained above. I hope somebody can clarify how this options can be configured properly the CMake way. PS: I'm using cmake version 2.8.12.2 -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-KeyId: 5AAC50C4 GPG-Fingerprint: 967A 15F1 2788 164D CCA3 6C46 07CD 6F82 5AAC 50C4 -- ascolab GmbH Geschäftsführer: Gerhard Gappmeier, Matthias Damm, Uwe Steinkrauß Sitz der Gesellschaft: Am Weichselgarten 7 • 91058 Erlangen • Germany Registernummer: HRB 9360 Registergericht: Amtsgericht Fürth
signature.asc
Description: This is a digitally signed message part.
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
