<div dir="ltr"><div><div>Hi Dave,<br><br></div>try <br>   add_definitions("-x c++")<br></div><div><br>CMakeLists.txt<br>cmake_minimum_required(VERSION 3.0 FATAL_ERROR)<br>project(asm CXX)<br>add_definitions("-x c++")<br>set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)<br>add_executable(foo foo.bar)<br>set_target_properties(foo PROPERTIES LINKER_LANGUAGE CXX)<br><br></div><div>Adam<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 17, 2015 at 2:10 PM, Dave Yost <span dir="ltr"><<a href="mailto:Dave@yost.com" target="_blank">Dave@yost.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>From what I can glean online, I’ve tried this:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>set_source_files_properties(foo.bar  PROPERTIES  LANGUAGE  CXX)</div><div>add_executable(foo  foo.bar)</div><div>set_target_properties(foo  PROPERTIES  LINKER_LANGUAGE  CXX)</div></blockquote><div><br></div><div>but it doesn’t work.</div><div>What am I missing?</div><div><br></div><div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">0 Mon 20:16:15 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)"><span style="color:#ffcf82">1181 Z% </span>cat CMakeLists.txt    </div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">cmake_minimum_required(VERSION 3.0 FATAL_ERROR)</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">project(asm CXX)</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17);min-height:10px"><br></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">add_executable(foo foo.bar)</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">set_target_properties(foo PROPERTIES LINKER_LANGUAGE CXX)</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">0 Mon 20:16:43 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)"><span style="color:#ffcf82">1182 Z% </span>cat foo.bar </div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">#include <iostream></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17);min-height:10px"><br></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">int main(int argc, char* argv[]) {</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">  std::cout << "Hello\"\n";</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">  return 0;</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">}</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">0 Mon 20:16:46 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)"><span style="color:#ffcf82">1183 Z% </span>cd build ; cmake ..       </div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- The CXX compiler identification is GNU 4.9.2</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler has -isysroot</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler has -isysroot - yes</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler supports OSX deployment target flag</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler supports OSX deployment target flag - yes</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Check for working CXX compiler: /opt/local/bin/c++</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Check for working CXX compiler: /opt/local/bin/c++ -- works</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compiler ABI info</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compiler ABI info - done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compile features</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compile features - done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Configuring done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Generating done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Build files have been written to: /Users/yost/p/c++/cmake/asm/build</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">0 Mon 20:16:58 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">1184 Z% <span style="color:#ffffff">make</span></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(217,64,215);background-color:rgb(5,13,17)">Scanning dependencies of target foo</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(56,191,42);background-color:rgb(5,13,17)"><span style="color:#ffffff">[100%] </span>Building CXX object CMakeFiles/foo.dir/foo.bar.o</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file unused because linking not done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(200,60,36);background-color:rgb(5,13,17)">Linking CXX executable foo</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">c++: error: CMakeFiles/foo.dir/foo.bar.o: No such file or directory</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">CMakeFiles/foo.dir/build.make:85: recipe for target 'foo' failed</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: *** [foo] Error 1</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/foo.dir/all' failed</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[1]: *** [CMakeFiles/foo.dir/all] Error 2</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">Makefile:75: recipe for target 'all' failed</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make: *** [all] Error 2</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">2 Mon 20:17:01 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">1185 Z% <span style="color:rgb(255,255,255)">rm -rf * ; cmake ..</span></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">zsh: sure you want to delete all the files in /Users/yost/p/c++/cmake/asm/build [yn]? y</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- The CXX compiler identification is GNU 4.9.2</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler has -isysroot</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler has -isysroot - yes</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler supports OSX deployment target flag</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Checking whether CXX compiler supports OSX deployment target flag - yes</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Check for working CXX compiler: /opt/local/bin/c++</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Check for working CXX compiler: /opt/local/bin/c++ -- works</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compiler ABI info</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compiler ABI info - done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compile features</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Detecting CXX compile features - done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Configuring done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Generating done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">-- Build files have been written to: /Users/yost/p/c++/cmake/asm/build</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">0 Mon 20:23:00 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)"><span style="color:#ffcf82">1201 Z% </span>make VERBOSE=1</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">/Applications/CMake.app/Contents/bin/cmake -H/Users/yost/p/c++/cmake/asm -B/Users/yost/p/c++/cmake/asm/build --check-build-system CMakeFiles/Makefile.cmake 0</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_start /Users/yost/p/c++/cmake/asm/build/CMakeFiles /Users/yost/p/c++/cmake/asm/build/CMakeFiles/progress.marks</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make -f CMakeFiles/Makefile2 all</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[1]: Entering directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/depend</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">cd /Users/yost/p/c++/cmake/asm/build && /Applications/CMake.app/Contents/bin/cmake -E cmake_depends "Unix Makefiles" /Users/yost/p/c++/cmake/asm /Users/yost/p/c++/cmake/asm /Users/yost/p/c++/cmake/asm/build /Users/yost/p/c++/cmake/asm/build /Users/yost/p/c++/cmake/asm/build/CMakeFiles/foo.dir/DependInfo.cmake --color=</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">Dependee "/Users/yost/p/c++/cmake/asm/build/CMakeFiles/foo.dir/DependInfo.cmake" is newer than depender "/Users/yost/p/c++/cmake/asm/build/CMakeFiles/foo.dir/depend.internal".</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">Dependee "/Users/yost/p/c++/cmake/asm/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/Users/yost/p/c++/cmake/asm/build/CMakeFiles/foo.dir/depend.internal".</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(217,64,215);background-color:rgb(5,13,17)">Scanning dependencies of target foo</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: Leaving directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/build</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">/Applications/CMake.app/Contents/bin/cmake -E cmake_progress_report /Users/yost/p/c++/cmake/asm/build/CMakeFiles 1</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(56,191,42);background-color:rgb(5,13,17)"><span style="color:#ffffff">[100%] </span>Building CXX object CMakeFiles/foo.dir/foo.bar.o</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#ffc4ab">/opt/local/bin/c++     -o CMakeFiles/foo.dir/foo.bar.o -c /Users/yost/p/c++/cmake/asm/foo.bar</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file unused because linking not done</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(200,60,36);background-color:rgb(5,13,17)">Linking CXX executable foo</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">/Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/foo.dir/link.txt --verbose=1</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#ffc4ab">/opt/local/bin/c++    -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/foo.dir/foo.bar.o  -o foo  </font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">c++: error: CMakeFiles/foo.dir/foo.bar.o: No such file or directory</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,255,255);background-color:rgb(5,13,17)">CMakeFiles/foo.dir/build.make:85: recipe for target 'foo' failed</div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: *** [foo] Error 1</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[2]: Leaving directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/foo.dir/all' failed</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[1]: *** [CMakeFiles/foo.dir/all] Error 2</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make[1]: Leaving directory '/Users/yost/p/c++/cmake/asm/build'</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">Makefile:75: recipe for target 'all' failed</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;background-color:rgb(5,13,17)"><font color="#caf0fe">make: *** [all] Error 2</font></div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">2 Mon 20:23:04 yost</div><div style="margin:0px;font-size:9px;font-family:Menlo;color:rgb(255,207,130);background-color:rgb(5,13,17)">1202 Z% </div></div><div><br></div><div>(I added the light blue and orange coloring by hand for readability.)</div><div><br></div></div><br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>