Re: [CMake] nonstandard C++ source filename extension

2015-03-25 Thread Brad King
On Tue, Mar 17, 2015 at 12:10 AM, Dave Yost wrote:
 set_source_files_properties(foo.bar  PROPERTIES  LANGUAGE  CXX)
[snip]
 [100%] Building CXX object CMakeFiles/foo.dir/foo.bar.o
 c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file unused
 because linking not done
 Linking CXX executable foo
 c++: error: CMakeFiles/foo.dir/foo.bar.o: No such file or directory

The LANGUAGE property just tells CMake what the language is in
case CMake does not know an extension supported by a particular
compiler.  It does not cause the -x c++ or similar flag to be added:

 http://www.cmake.org/Bug/view.php?id=14516

The latter is needed to convince the compiler of the language.

-Brad
-- 

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


Re: [CMake] nonstandard C++ source filename extension

2015-03-19 Thread Bill Hoffman

This works for me:

---CMakeLists.txt
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(asm CXX)
add_executable(foo foo.bar)
set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)

---foo.bar---
int main() { return 0;}


$ /cygdrive/c/Program\ Files\ \(x86\)/CMake/bin/cmake -GNinja ..
-- The CXX compiler identification is MSVC 16.0.40219.1
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/hoffman/foo/b

hoffman@quasar ~/foo/b
$ ninja
[1/2] Building CXX object CMakeFiles\foo.dir\foo.bar.obj
foo.bar
[2/2] Linking CXX executable foo.exe

--

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


Re: [CMake] nonstandard C++ source filename extension

2015-03-17 Thread Petr Kmoch
Hi Dave.

This looks like a message directly from your compiler. Does it work if you
try to compile the file manually (no CMake)?

Petr

On Tue, Mar 17, 2015 at 5:10 AM, Dave Yost d...@yost.com wrote:

 From what I can glean online, I’ve tried this:

 set_source_files_properties(foo.bar  PROPERTIES  LANGUAGE  CXX)
 add_executable(foo  foo.bar)
 set_target_properties(foo  PROPERTIES  LINKER_LANGUAGE  CXX)


 but it doesn’t work.
 What am I missing?

 0 Mon 20:16:15 yost
 1181 Z% cat CMakeLists.txt
 cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
 project(asm CXX)

 set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)
 add_executable(foo foo.bar)
 set_target_properties(foo PROPERTIES LINKER_LANGUAGE CXX)
 0 Mon 20:16:43 yost
 1182 Z% cat foo.bar
 #include iostream

 int main(int argc, char* argv[]) {
   std::cout  Hello\\n;
   return 0;
 }
 0 Mon 20:16:46 yost
 1183 Z% cd build ; cmake ..
 -- The CXX compiler identification is GNU 4.9.2
 -- Checking whether CXX compiler has -isysroot
 -- Checking whether CXX compiler has -isysroot - yes
 -- Checking whether CXX compiler supports OSX deployment target flag
 -- Checking whether CXX compiler supports OSX deployment target flag - yes
 -- Check for working CXX compiler: /opt/local/bin/c++
 -- Check for working CXX compiler: /opt/local/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /Users/yost/p/c++/cmake/asm/build
 0 Mon 20:16:58 yost
 1184 Z% make
 Scanning dependencies of target foo
 [100%] Building CXX object CMakeFiles/foo.dir/foo.bar.o
 c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file
 unused because linking not done
 Linking CXX executable foo
 c++: error: CMakeFiles/foo.dir/foo.bar.o: No such file or directory
 CMakeFiles/foo.dir/build.make:85: recipe for target 'foo' failed
 make[2]: *** [foo] Error 1
 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/foo.dir/all' failed
 make[1]: *** [CMakeFiles/foo.dir/all] Error 2
 Makefile:75: recipe for target 'all' failed
 make: *** [all] Error 2
 2 Mon 20:17:01 yost
 1185 Z% rm -rf * ; cmake ..
 zsh: sure you want to delete all the files in
 /Users/yost/p/c++/cmake/asm/build [yn]? y
 -- The CXX compiler identification is GNU 4.9.2
 -- Checking whether CXX compiler has -isysroot
 -- Checking whether CXX compiler has -isysroot - yes
 -- Checking whether CXX compiler supports OSX deployment target flag
 -- Checking whether CXX compiler supports OSX deployment target flag - yes
 -- Check for working CXX compiler: /opt/local/bin/c++
 -- Check for working CXX compiler: /opt/local/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /Users/yost/p/c++/cmake/asm/build
 0 Mon 20:23:00 yost
 1201 Z% make VERBOSE=1
 /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
 /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
 make -f CMakeFiles/Makefile2 all
 make[1]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/depend
 make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 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=
 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.
 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.
 Scanning dependencies of target foo
 make[2]: Leaving directory '/Users/yost/p/c++/cmake/asm/build'
 make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/build
 make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_report
 /Users/yost/p/c++/cmake/asm/build/CMakeFiles 1
 [100%] Building CXX object CMakeFiles/foo.dir/foo.bar.o
 /opt/local/bin/c++ -o CMakeFiles/foo.dir/foo.bar.o -c
 /Users/yost/p/c++/cmake/asm/foo.bar
 c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file
 unused because linking not done
 Linking CXX executable foo
 

Re: [CMake] nonstandard C++ source filename extension

2015-03-17 Thread Adam
Hi Dave,

try
   add_definitions(-x c++)

CMakeLists.txt
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
project(asm CXX)
add_definitions(-x c++)
set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)
add_executable(foo foo.bar)
set_target_properties(foo PROPERTIES LINKER_LANGUAGE CXX)

Adam


On Tue, Mar 17, 2015 at 2:10 PM, Dave Yost d...@yost.com wrote:

 From what I can glean online, I’ve tried this:

 set_source_files_properties(foo.bar  PROPERTIES  LANGUAGE  CXX)
 add_executable(foo  foo.bar)
 set_target_properties(foo  PROPERTIES  LINKER_LANGUAGE  CXX)


 but it doesn’t work.
 What am I missing?

 0 Mon 20:16:15 yost
 1181 Z% cat CMakeLists.txt
 cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
 project(asm CXX)

 set_source_files_properties(foo.bar PROPERTIES LANGUAGE CXX)
 add_executable(foo foo.bar)
 set_target_properties(foo PROPERTIES LINKER_LANGUAGE CXX)
 0 Mon 20:16:43 yost
 1182 Z% cat foo.bar
 #include iostream

 int main(int argc, char* argv[]) {
   std::cout  Hello\\n;
   return 0;
 }
 0 Mon 20:16:46 yost
 1183 Z% cd build ; cmake ..
 -- The CXX compiler identification is GNU 4.9.2
 -- Checking whether CXX compiler has -isysroot
 -- Checking whether CXX compiler has -isysroot - yes
 -- Checking whether CXX compiler supports OSX deployment target flag
 -- Checking whether CXX compiler supports OSX deployment target flag - yes
 -- Check for working CXX compiler: /opt/local/bin/c++
 -- Check for working CXX compiler: /opt/local/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /Users/yost/p/c++/cmake/asm/build
 0 Mon 20:16:58 yost
 1184 Z% make
 Scanning dependencies of target foo
 [100%] Building CXX object CMakeFiles/foo.dir/foo.bar.o
 c++: warning: /Users/yost/p/c++/cmake/asm/foo.bar: linker input file
 unused because linking not done
 Linking CXX executable foo
 c++: error: CMakeFiles/foo.dir/foo.bar.o: No such file or directory
 CMakeFiles/foo.dir/build.make:85: recipe for target 'foo' failed
 make[2]: *** [foo] Error 1
 CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/foo.dir/all' failed
 make[1]: *** [CMakeFiles/foo.dir/all] Error 2
 Makefile:75: recipe for target 'all' failed
 make: *** [all] Error 2
 2 Mon 20:17:01 yost
 1185 Z% rm -rf * ; cmake ..
 zsh: sure you want to delete all the files in
 /Users/yost/p/c++/cmake/asm/build [yn]? y
 -- The CXX compiler identification is GNU 4.9.2
 -- Checking whether CXX compiler has -isysroot
 -- Checking whether CXX compiler has -isysroot - yes
 -- Checking whether CXX compiler supports OSX deployment target flag
 -- Checking whether CXX compiler supports OSX deployment target flag - yes
 -- Check for working CXX compiler: /opt/local/bin/c++
 -- Check for working CXX compiler: /opt/local/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 -- Detecting CXX compile features
 -- Detecting CXX compile features - done
 -- Configuring done
 -- Generating done
 -- Build files have been written to: /Users/yost/p/c++/cmake/asm/build
 0 Mon 20:23:00 yost
 1201 Z% make VERBOSE=1
 /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
 /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
 make -f CMakeFiles/Makefile2 all
 make[1]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/depend
 make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 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=
 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.
 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.
 Scanning dependencies of target foo
 make[2]: Leaving directory '/Users/yost/p/c++/cmake/asm/build'
 make -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/build
 make[2]: Entering directory '/Users/yost/p/c++/cmake/asm/build'
 /Applications/CMake.app/Contents/bin/cmake -E cmake_progress_report
 /Users/yost/p/c++/cmake/asm/build/CMakeFiles 1
 [100%] Building CXX object CMakeFiles/foo.dir/foo.bar.o
 /opt/local/bin/c++ -o CMakeFiles/foo.dir/foo.bar.o -c
 /Users/yost/p/c++/cmake/asm/foo.bar
 c++: