in Education by
I'm working with a code generator that produces C++ and a CMakeLists.txt file, unfortunately I cannot use this in my main CMakeLists.txt file for testing purposes. For example you have the following CMakeLists.txt file: project(SomeProject CXX C) add_custom_command(OUTPUT ${SRCS} COMMAND ${CODEGEN_CLI_PATH} -i "${INPUT}" -o "${OUT}" COMMENT "Generating sources" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM ) add_custom_target(CODEGEN DEPENDS ${SRCS} ) # Needs to be executed after the custom command add_subdirectory(${GENERATED_CMAKE_LISTS_LOCATION}) Is it possible to use functions such as add_subdirectory only after you execute custom commands for a particular target, such as CODEGEN? I've already tried to execute it by adding an extra line to the existing custom command: COMMAND ${CMAKE_COMMAND} -D DIR=${GENERATED_CMAKE_LISTS_LOCATION} -P add_subdirectories.cmake Unfortuantly this doesn't work because it isn't allowed to execute functions like add_subdirectory in script mode. Neither I can manage to call custom made functions (that are executing add_subdirectory) from add_custom_command that are located in the same file. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Nope, it is not possible. The add_subdirectory command is run during configuration step, while CODEGEN is a target that runs during build. You seem to be doing something wrong, so the only advice I can give you is to use execute_process command to run commands you need. The execute_process command is executed during configuration stage, so it will be able to generate files you need before add_subdirectory. But again, please describe your problem, why do you want CMake to do that.

Related questions

0 votes
    You can time ________ expressions by wrapping them in curly braces within the call to system.time(). (a) ... Analysis of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    A gitlab-runner configuration script .gitlab-ci.yml, for execution in the Powershell: windows: tags: - ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 17, 2022 in Education by JackTerrance
0 votes
    In Twilio Rest API for each call there is a response which uniquely identify calls Twilio-Request-Id: ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 19, 2022 in Education by JackTerrance
0 votes
    When a user end a call from the CallKit UI the app ends the call and the actual VOIP call also ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 3, 2022 in Education by JackTerrance
0 votes
    How to call an external command?...
asked Jan 9, 2021 in Technology by JackTerrance
0 votes
    I want to execute a curl command in python. curl -d @request.json --header "Content-Type: application/json" https: ... Help me fix it. Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
0 votes
    I want to execute a curl command in python. curl -d @request.json --header "Content-Type: application/ ... Core Questions, Core Hadoop MCQ,core interview questions for experienced...
asked Oct 31, 2021 in Education by JackTerrance
0 votes
    To define the executable java file we call it in _________. A. @CucumberOptions B. @RunWith() C. @Features D. @RunWith...
asked Dec 13, 2022 in Technology by JackTerrance
0 votes
    All compilers I could get my hands on agree that this is fine: template auto foo(Check, T...) - ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 14, 2022 in Education by JackTerrance
0 votes
    I currently have a UIView, call it (A), that is outsourced out into a 3rd party library. Pressing ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 8, 2022 in Education by JackTerrance
0 votes
    I have following code and I want to get data from service. I have set everything from what I get ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 19, 2022 in Education by JackTerrance
0 votes
    I have a WCF service which is called in 4 different places in my system. It returns approx 500 ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I want create expression with reflection in c#. I am target script is: using (var service = new ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 14, 2022 in Education by JackTerrance
0 votes
    I have following code and I want to get data from service. I have set everything from what I get ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 12, 2022 in Education by JackTerrance
0 votes
    I found this example on the official site of DialogFlow using Node.js and it is working fine, but ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
...