The following to the bottom of the top level CMakeLists. We want our project to also be used from a build directory we only have to add The thing you make here is called a target, and the executable/library has the same name, by default, and it has to be unique in the project. You need at least one library or executable to do anything interesting. I had a quick look at the top level CMakeLists.txt in the github project you linked to and it looks like it already makes use of options like in strategy 3, just not quite to turn on/off individual subdirectories. In this tutorial we will use the following project structure: cmake-tutorial/ CMakeLists.txt. Hopefully one of the above options or some combination thereof gives you some ideas for how to ultimately achieve what you are aiming for. Project that can be used after the project has been installed or packaged. CMake assumes a CXX (that’s C++) and C mixed project if you don’t give any LANGUAGES. Build the project using cmake(1) with third party library. option (BUILDSHAREDLIBS 'Build using shared libraries' ON) Next, we need to specify output directories for our static and shared libraries. I found a FindSDL2.cmake file in the answer referenced in the Accepted Answer. Copy the FindSDL2.cmake module and place it in a new 'cmake' directory within your project. Paste this folder in your C:\Program Files (x86)\ directory. We use the option () command as it allows users to optionally select if the value should be ON or OFF. Extract the zip folder and you should see a folder similar to 'SDL2-2.0.9'. Enable_testing() # does the application run add_test( NAME Runs COMMAND Tutorial 25 ) # does the usage message work? add_test( NAME Usage COMMAND Tutorial ) set_tests_properties( Usage PROPERTIES PASS_REGULAR_EXPRESSION "Usage.*number" ) # define a function to simplify adding tests function( do_test target arg result ) add_test( NAME Comp $ /MathFunctionsConfig.cmake DESTINATION lib/cmake/MathFunctions )Īt this point, we have generated a relocatable CMake Configuration for our To accomplish this we need to add BUILDSHAREDLIBS to the top-level CMakeLists.txt. First, fill in the one line CMakeLists.txt in the MathFunctions subdirectory.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |