[CMake] add_compile_options query

CHEVRIER, Marc marc.chevrier at sap.com
Fri Aug 12 07:51:49 EDT 2016


Specify flags as strings rather than lists (i.e. add quotes):
    add_compile_options("--param l1-cache-size=24")
    add_compile_options("--param l1-cache-line-size=64")
    add_compile_options("--param l2-cache-size=512")
    


On 12/08/16 11:08, "CMake on behalf of Alex Biddulph" <cmake-bounces at cmake.org on behalf of c3124185 at uon.edu.au> wrote:

    Hi,
    
    I am trying to add some GCC compiler optimisation flags using the add_compile_options directive but am running into some issues due to the nature of the flags.
    
    There are 3 flags that I am trying to set:
    --param l1-cache-size=24
    --param l1-cache-line-size=64
    --param l2-cache-size=512
    
    If I try to add these as:
    add_compile_options(--param l1-cache-size=24)
    add_compile_options(--param l1-cache-line-size=64)
    add_compile_options(--param l2-cache-size=512)
    
    Then the resulting portion of the command line is: 
    --param l1-cache-size=24 l1-cache-line-size=64 l2-cache-size=512
    
    That is, only one of the '--param's is maintained, but all 3 need to be maintained in order for GCC to understand the flags.
    
    Is it possible to use add_compile_options to set these flags? Or is there another more effective method? I would like to avoid adding them to CFLAGS and CXXFLAGS if at all possible.
    
    Thanks in advance,
    Alex
    -- 
    
    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://public.kitware.com/mailman/listinfo/cmake
    



More information about the CMake mailing list