I have tried specifying the parameters with both single and double quotes, both 
options raise errors on the command line.

With no quotes:
FAILED: /usr/bin/gcc -march=broadwell -mtune=broadwell -m64 -mabm -madx
  -maes -mavx -mavx2 -mbmi -mbmi2 -mcx16 -mf16c -mfma -mfsgsbase -mfxsr
  -mlzcnt -mmmx -mmovbe -mpclmul -mpopcnt -mprfchw -mrdrnd -mrdseed -msahf
  -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mxsave -mxsaveopt
  --param l1-cache-size=24 l1-cache-line-size=64 l2-cache-size=512 -o
  CMakeFiles/cmTC_59f68.dir/testCCompiler.c.o -c testCCompiler.c

  gcc: error: l1-cache-line-size=64: No such file or directory

  gcc: error: l2-cache-size=512: No such file or directory


With single quotes:
FAILED: /usr/bin/gcc -march=broadwell -mtune=broadwell -m64 -mabm -madx
  -maes -mavx -mavx2 -mbmi -mbmi2 -mcx16 -mf16c -mfma -mfsgsbase -mfxsr
  -mlzcnt -mmmx -mmovbe -mpclmul -mpopcnt -mprfchw -mrdrnd -mrdseed -msahf
  -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mxsave -mxsaveopt
  "'--param" "l1-cache-size=24'" "l1-cache-line-size=64'"
  "l2-cache-size=512'" -o CMakeFiles/cmTC_dad73.dir/testCCompiler.c.o -c
  testCCompiler.c

  gcc: error: '--param: No such file or directory

  gcc: error: l1-cache-size=24': No such file or directory

  gcc: error: l1-cache-line-size=64': No such file or directory

  gcc: error: l2-cache-size=512': No such file or directory

With double quotes:
FAILED: /usr/bin/gcc -march=broadwell -mtune=broadwell -m64 -mabm -madx
  -maes -mavx -mavx2 -mbmi -mbmi2 -mcx16 -mf16c -mfma -mfsgsbase -mfxsr
  -mlzcnt -mmmx -mmovbe -mpclmul -mpopcnt -mprfchw -mrdrnd -mrdseed -msahf
  -msse -msse2 -msse3 -msse4 -msse4.1 -msse4.2 -mssse3 -mxsave -mxsaveopt
  "--param l1-cache-size=24" "--param l1-cache-line-size=64" "--param
  l2-cache-size=512" -o CMakeFiles/cmTC_09224.dir/testCCompiler.c.o -c
  testCCompiler.c

  gcc: error: unrecognized command line option ‘--param l1-cache-size=24’

  gcc: error: unrecognized command line option ‘--param
  l1-cache-line-size=64’

  gcc: error: unrecognized command line option ‘--param
  l2-cache-size=512’

If I only specify one of the flags (with no single/double quotes) gcc accepts 
the flag.


Thanks,

Alex


________________________________
From: CHEVRIER, Marc <marc.chevr...@sap.com>
Sent: Friday, 12 August 2016 9:51:49 PM
To: Alexander Biddulph; cmake@cmake.org
Subject: Re: [CMake] add_compile_options query


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-boun...@cmake.org 
on behalf of c3124...@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<http://www.kitware.com>
[http://www.kitware.com/img/Areas_Index_Home.jpg]<http://www.kitware.com/>

Kitware Inc. - leading edge, high-quality software<http://www.kitware.com/>
www.kitware.com
Kitware's mission is to create state-of-the-art software products and services 
in visualization and data processing using advanced quality software methods 
and ...



    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


-- 

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

Reply via email to