![]() ![]() Now if some_input.xml is changed I want to also rebuild some_lib. #some_source.c may be modified by the following custom commandĬOMMAND $/generated)Īdd_dependencies(some_lib generate_something) The source for this code is within the source-tree and it must stay there, I have no freedom here. The library is depending on some code which may be generated before-hand by a custom command. I might move this particular file generation to the build process, but haven't decided yet now that I've learned more about the cmake process overall.Iam using CMake together with ninja to build a library. So if the configuration process generates an output from a given input, the fact that the output might be missing doesn't, by itself, trigger the configuration process to regenerate it? Something else must cause the configuration to occur, which would then cause it to regenerate that output? For example, if an input to the configuration process (such as my `` file) changes, then that triggers the configuration process? That would all align with my observations. What I gather from your last post is that the configuration process, though, doesn't handle "dependencies" between its inputs and outputs the way the build process does. The configuration process has inputs and outputs, as the build process does. I've understood that `configure_file` occurs during the configuration process, naturally, but what I haven't understood is what triggers the configuration process to occur. I've looked at a couple of textbooks on cmake, and they don't really do a good job explaining the configuration vs build process in terms of what triggers each one. Thank you very much, I've been learning cmake bit by bit as I've just gotten into trying to customize the CMakeLists.txt generated by ESP-IDF. ![]() I guess I don't understand why, if `configure_file` is doing what it is supposed to and creating the output if it's not there or if it's older than the input file and it's doing so prior to the build, why isn't the compile of the source that includes it seeing the file in its target location? This means I'll need to scrounge for or write a script that does exactly what `configure_file` does. Your post seems to indicate that, for me to get the dependency effect I'm looking for, I need to create the Application.hpp at build time using `add_custom_command`. So it either is for some reason deciding not to create it even though it's missing, or it creates it but it's not in a location initially that the compiler can find when compiling the cpp file that includes it. It seems that the information "out there" about how to configure cmake for this kind thing is varied and, in my opinion of average fidelity.Īlthough `configure_file` creates the output during configuration, there's something wrong if I run a build after only a build clean or if I just delete the Application.hpp before rebuilding. I have read a lot online trying to figure out how to get the build of a source file to depend upon the `configure_file` result and I kept running into the need for the `add_custom_target`. Here's my updated CMakeLists.txt at the top level which I updated based upon what I have read.Ĭode: Select all cmake_minimum_required(VERSION 3.16.0) Under the `include` folder is the header input file I want to generate from, called ``. The build process creates a `build` subfolder. In the top project folder (CMAKE_SOURCE_DIR) is my main CMakeLists.txt.īelow this is a `main` subfolder with all the cpp files, and an `include` folder with all the header files. I've read a couple of different text books and looked at many CMake posts on this topic and it hasn't quite gotten me there. The dependencies should be setup by CMake such that the generated header file is generated if it doesn't exist or if the source input file is newer, and it must do this before attempting to compile the cpp file(s) that depend upon it. What I want to do is generate a header file with some inserted CMake variables (like project name and version) and include that header in a couple of different cpp files. ![]() I am using ESP-IDF 4.4.2 and cmake 3.23.1. ![]() I am trying to customize my CMakeLists.txt for ESP-IDF build. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |