Note that you must not specify a build type (Debug or Release) since it apparently conflicts with the manually set compiler flags. Set(CMAKE_EXE_LINKER_FLAGS "-s") # Strip binary This is an example that shows how to do it: cmake_minimum_required(VERSION 2.6) So before forcing compiler options, you need to check that the compiler is really GCC. However, keep in mind that a CMakeLists.txt file should ideally work with many compilers. Last, if you are a GCC wizard and you want full control of the options passed to the compiler, you can also set them manually. And if you find uncomfortable to have to edit the CMakeLists.txt file to switch between Release and Debug mode, you can also specify the option in the CMake command line, like this: mkdir build & cd build usr/bin/c++ -O3 -DNDEBUG CMakeFiles/hello.dir/ CMakeFiles/hello.dir/ usr/bin/c++ -O3 -DNDEBUG -o CMakeFiles/hello.dir/ -c /tmp/cmaketest/foo.cpp usr/bin/c++ -O3 -DNDEBUG -o CMakeFiles/hello.dir/ -c /tmp/cmaketest/main.cpp With the Release build type, the options passed to the compiler are these: Of course, change “Release” with “Debug” for debug builds. To fix this you simply need to specify a build type in the CMakeLists.txt file, in this way: set(CMAKE_BUILD_TYPE Release)Īt the end of your CMakeLists.txt file. The build type is a feature most IDE have, it allows you to compile your program in “debug” mode, for easily single-stepping through it with a debugger, or in “release” mode, with speed optimization enabled. That’s because no build type has been specified to CMake. Now, if you’ve read my previous blog post on GCC’s compiler flags, you might probably not like what you see, since no optimization flag has been passed to GCC and as a result, your program won’t run as fast as it should. usr/bin/c++ CMakeFiles/hello.dir/ CMakeFiles/hello.dir/ -o hello usr/bin/c++ -o CMakeFiles/hello.dir/ -c /tmp/cmaketest/foo.cpp Building CXX object CMakeFiles/hello.dir/ usr/bin/c++ -o CMakeFiles/hello.dir/ -c /tmp/cmaketest/main.cpp Here is the relevant part of the printout: But if the goal is to see the compiler flags used, it is always possible to override this behaviour with the VERBOSE=1 option. By default CMake hides the options passed to the compiler, and displays a higher level status indicator with the build completion percentage together with the name of the file currently being built (a much more elegant solution than autoconf). The interesting thing here is the VERBOSE=1 option. To do so, it is possible to use the commands: mkdir build & cd build ![]() But let’s see exactly what CMake does to compile these files. The first CMakeLists.txt looked like this: cmake_minimum_required(VERSION 2.6)Īs already explained, it successfully creates an executable called “hello” using the main.cpp and foo.cpp source files. Now it’s time to explore the CMake syntax further. I am certain we will return to this restaurant when we visit Myrtle Beach in the future.It’s not the first time I talk about CMake in this blog, for the introduction read here. It was a bit more expensive than we had expected (of course we had very low expectations of any buffet), but as another reviewer commented, 'you get what you pay for'. The servers were friendly, they kept our table clean, and our glasses filled. While the restaurant was huge and most tables were filled, we did not feel at all crowded and never had to wait in line for anything. The food was fresh - not overcooked, or left to sit under warmers for too long. ![]() The restaurant was very clean, the buffet was well stocked with many choices, it was clean and organized. The hostess was pleasant and had no problem with us checking out the restaurant before deciding to stay. We happened to drive by Captain Georges and decided to at least take a look at what they had to offer. As a family, we just DO NOT do buffets, however, our 15 year old daughter loves crab legs and could easily eat more than any grown man, so we had been contemplating a visit to a seafood buffet restaurant while in Myrtle Beach.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |