<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jun 2, 2018 at 6:32 AM, Chris Green <span dir="ltr"><<a href="mailto:greenc@fnal.gov" target="_blank">greenc@fnal.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>Ack! Apparently even the hard way won't work, because apparently
      one cannot nest <tt>$<IF</tt> clauses, viz:</p>
    <pre> set(CXX_STD_FLAG "$<IF:$<TARGET_PROPERTY:${<wbr>dictname}_dict,CXX_EXTENSIONS><wbr>,\
$<IF:$<EQUAL:11,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX11_<wbr>EXTENSION_COMPILE_OPTION},\
$<IF:$<EQUAL:14,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX14_<wbr>EXTENSION_COMPILE_OPTION},\
$<IF:$<EQUAL:17,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX17_<wbr>EXTENSION_COMPILE_OPTION},\
$<IF:$<EQUAL:20,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX20_<wbr>EXTENSION_COMPILE_OPTION},\
${CMAKE_CXX98_EXTENSION_<wbr>COMPILE_OPTION}>>>>,\
$<IF:$<EQUAL:11,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX11_<wbr>STANDARD_COMPILE_OPTION},\
$<IF:$<EQUAL:14,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX14_<wbr>STANDARD_COMPILE_OPTION},\
$<IF:$<EQUAL:17,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX17_<wbr>STANDARD_COMPILE_OPTION},\
$<IF:$<EQUAL:20,$<TARGET_<wbr>PROPERTY:${dictname}_dict,CXX_<wbr>STANDARD>>,${CMAKE_CXX20_<wbr>STANDARD_COMPILE_OPTION},\
${CMAKE_CXX98_STANDARD_<wbr>COMPILE_OPTION}>>>>>")
</pre>
    <p>begets:</p>
    <pre>  First parameter to $<IF> must resolve to exactly one '0' or '1' value.
</pre>
    <p>I'm all out of ideas. Any new ones would be appreciated.</p></div></blockquote><div><br></div><div>The very first line of that is assuming the CXX_EXTENSIONS target property resolves to 0 or 1, but it could be other boolean constants like YES, NO, TRUE, FALSE, etc. Wrap it in $<BOOL:...> to make it robust:</div><div><br></div><div><pre style="white-space:pre-wrap">set(CXX_STD_FLAG "$<IF:$<BOOL:$<TARGET_PROPERTY:${<wbr>dictname}_dict,CXX_EXTENSIONS>><wbr>,\</pre></div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><div><div class="gmail-h5">
    <div class="gmail-m_7809035639829332968moz-cite-prefix">On 6/1/18 3:00 PM, Chris Green wrote:<br>
    </div>
    <blockquote type="cite">
      
      <p>Hi,</p>
      <p>I was hoping this would work:</p>
      <pre>$<IF:$<TARGET_PROPERTY:CXX_<wbr>EXTENSIONS>,${CMAKE_CXX$<<wbr>TARGET_PROPERTY:CXX_STANDARD>_<wbr>EXTENSION_COMPILE_OPTION},${<wbr>CMAKE_CXX$<TARGET_PROPERTY:<wbr>CXX_STANDARD>_STANDARD_<wbr>COMPILE_OPTION}>
</pre>
      <p>But apparently it's not legal to calculate a variable name
        based on a generator expression. Is there some elegant way to
        get want I want here or do I have to check specifically for 98,
        11, 14, 17, 20, etc?</p>
      <p>Thanks,</p>
      <p>Chris.<br>
      </p>
      <br>
      <div class="gmail-m_7809035639829332968moz-cite-prefix">On 6/1/18 8:27 AM, Chris Green wrote:<br>
      </div>
      <blockquote type="cite">
        
        <p>Hi,</p>
        <p>I'll give this a shot, thank you. Ideally we'd have a
          generator expression pick up ${std} from the relevant target
          property, but I'll have to play with that since I'm not
          familiar enough with generator expressions to know <i>a
            priori</i> how this will turn out.</p>
        <p>Thanks for your help,</p>
        <p>Chris.<br>
        </p>
         <br>
        <div class="gmail-m_7809035639829332968moz-cite-prefix">On 5/30/18 3:12 PM, Chuck Atkins
          wrote:<br>
        </div>
        <blockquote type="cite">
          
          <div dir="ltr">Hi Chris.<br>
            <div>
              <div class="gmail_extra">
                <div class="gmail_quote"><br>
                  <div>Try using the the
                    CMAKE_CXX${std}_STANDARD_<wbr>COMPILE_OPTION variable. 
                    For example, the folowing piece of CMake code:</div>
                  <div style="margin-left:40px"><span style="font-family:monospace,monospace">cmake_minimum_required(VERSION
                      3.9)<br>
                      <br>
                      project(foo CXX)<br>
                          <br>
                      foreach(std IN ITEMS 98 11 14 17)<br>
                        message("C++${std} std flags:
                      ${CMAKE_CXX${std}_STANDARD_<wbr>COMPILE_OPTION}")<br>
                        message("C++${std} ext flags:
                      ${CMAKE_CXX${std}_EXTENSION_<wbr>COMPILE_OPTION}")<br>
                      endforeach()</span><br>
                    <br>
                  </div>
                  <div>Wll generate for GCC on Linux:</div>
                  <div style="margin-left:40px"><span style="font-family:monospace,monospace">-- The CXX
                      compiler identification is GNU 8.1.1<br>
                      -- Check for working CXX compiler: /usr/bin/c++<br>
                      -- Check for working CXX compiler: /usr/bin/c++ --
                      works<br>
                      -- Detecting CXX compiler ABI info<br>
                      -- Detecting CXX compiler ABI info - done<br>
                      -- Detecting CXX compile features<br>
                      -- Detecting CXX compile features - done<br>
                      C++98 std flags: -std=c++98<br>
                      C++98 ext flags: -std=gnu++98<br>
                      C++11 std flags: -std=c++11<br>
                      C++11 ext flags: -std=gnu++11<br>
                      C++14 std flags: -std=c++14<br>
                      C++14 ext flags: -std=gnu++14<br>
                      C++17 std flags: -std=c++1z<br>
                      C++17 ext flags: -std=gnu++1z<br>
                      -- Configuring done</span><br>
                  </div>
                  <div><br>
                  </div>
                  <div>PGI on Linux:</div>
                  <div style="margin-left:40px"><span style="font-family:monospace,monospace">-- The CXX
                      compiler identification is PGI 18.4.0<br>
                      -- Check for working CXX compiler:
                      /opt/pgi/linux86-64/18.4/bin/<wbr>pgc++<br>
                      -- Check for working CXX compiler:
                      /opt/pgi/linux86-64/18.4/bin/<wbr>pgc++ -- works<br>
                      -- Detecting CXX compiler ABI info<br>
                      -- Detecting CXX compiler ABI info - done<br>
                      -- Detecting CXX compile features<br>
                      -- Detecting CXX compile features - done<br>
                      C++98 std flags: -A<br>
                      C++98 ext flags: --gnu_extensions<br>
                      C++11 std flags: --c++11;-A<br>
                      C++11 ext flags: --c++11;--gnu_extensions<br>
                      C++14 std flags: --c++14;-A<br>
                      C++14 ext flags: --c++14;--gnu_extensions<br>
                      C++17 std flags: --c++17;-A<br>
                      C++17 ext flags: --c++17;--gnu_extensions<br>
                      -- Configuring done</span><br>
                    <br>
                  </div>
                  <div><br>
                  </div>
                  <div>And for IBM XL on AIX:</div>
                  <div>
                    <div style="margin-left:40px"><span style="font-family:monospace,monospace">-- The
                        CXX compiler identification is XL 13.1.3<br>
                        -- Check for working CXX compiler: /usr/bin/xlC<br>
                        -- Check for working CXX compiler: /usr/bin/xlC
                        -- works<br>
                        -- Detecting CXX compiler ABI info<br>
                        -- Detecting CXX compiler ABI info - done<br>
                        -- Detecting CXX compile features<br>
                        -- Detecting CXX compile features - done<br>
                        C++98 std flags: -qlanglvl=strict98<br>
                        C++98 ext flags: -qlanglvl=extended<br>
                        C++11 std flags: -qlanglvl=extended0x<br>
                        C++11 ext flags: -qlanglvl=extended0x<br>
                        C++14 std flags: <br>
                        C++14 ext flags: <br>
                        C++17 std flags: <br>
                        C++17 ext flags: <br>
                        -- Configuring done<br>
                        -- Generating done</span><br>
                    </div>
                  </div>
                  <br>
                </div>
                - Chuck<br>
              </div>
            </div>
          </div>
        </blockquote>
        <br>
      </blockquote>
      </blockquote></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Craig Scott<br><div>Melbourne, Australia</div><div><a href="https://crascit.com" target="_blank">https://crascit.com</a><br></div></div></div></div></div></div></div>
</div></div>