I tried add_custom_target with POST_BUILD and manually installing it there then adding a dependency to the library build by the second subdirectory on that target but it doesn’t do it and i can’t force it to not be configured until the first subdirectory is finished installing.
in the configuring/generating of the second subdirectory i need the executable from the first subdirectory to compile things in the second and also for find_package so configuring gives errors and i cant make it wait for installation. i’m not sure if there’s a way to make the add_subdirectory() wait for that. I tried externalproject but linking the libraries to my target doesn’t work for some reason and alot of variables don’t get set when passing them as -D in the externalproject_add() im not sure why.
sorry for not properly explaining,
i have 2 subdirectories, 1 builds an executable needed by the second subdirectory so i want to configure the second subdirectory after the first subdirectory is installed so it can find the executable to use in configuration/generation.
im trying to make the question as general as possible but if it helps it’s protobuf and the executable is protoc
You cannot add_subdirectory from a script or a custom target. The way to solve this is to make the build/install of your libprotobuf execute during configure of the main project, such as via execute_process
thank you, execute process works every time. i also want to add ExternalProject works too but sometimes variables don’t get set when they are passed to the externalproject through CMAKE_ARGS without changing any files and i don’t know of a way to force variables like i would with set( [FORCE]) but for external project so im not sure why that happens.