Never mind, I just saw my silly typo. Two dashes (--) instead of one (-). :-)
On Monday, August 11, 2014 6:58:05 PM UTC+2, Petter Strandmark wrote: > > I have uploaded a minimum example at > https://github.com/PetterS/emscripten_cmake which uses CMake to build a > program. > > It works fine (on Windows) as it is. However, I am using the CMake command > > add_definitions("-std=c++11") > > > to enable C++11. This is a problem if I also have some C files I want to > compile in my project. I have tried > > set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11") > > > but that fails with the message > > FAILED: c:\Program\Emscripten\emscripten\1.21.0\em++.bat --std=c++11 > -DNDEBUG -O2 -MMD -MT CMakeFiles\my_program.dir\ > my_program.cpp.o -MF "CMakeFiles/my_program.dir/my_program.cpp.o.d" -o > CMakeFiles\my_program.dir\my_program.cpp.o -c c:\ > Users\Petter\Dropbox\Programming\emscripten-test\my_program.cpp > c:\Users\Petter\Dropbox\Programming\emscripten-test\my_program.cpp:10:2: > warning: 'auto' type specifier is a C++11 exten > sion [-Wc++11-extensions] > auto my_numbers = {1, 2, 3}; > ^ > c:\Users\Petter\Dropbox\Programming\emscripten-test\my_program.cpp:10:20: > error: cannot deduce type of initializer list > because std::initializer_list was not found; include <initializer_list> > auto my_numbers = {1, 2, 3}; > ^ > > > If I use the former add_definitions-approach, compiling C files fails with > > error: invalid argument '-std=c++11' not allowed with 'C/ObjC' > > > So I am stuck. For normal CMake projects, I use the CXX_FLAGS-approach to > set the flag for C++ only. > > Any thoughts on how I might solve my problem? > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
