I have a project that have a client and a server, so i have a top level CMakeList.txt and 2 subdirectory containing each a CMakeList.txt. Now i want 2 build for thoses projects, one native that build client and server, and another one that build emscripten version of the client. For now i use a simple bash script that invoke cmake with no toolchain first and a second that specify the emscripten toolchain. Additionnaly i have some if(EMSCRIPTEN) to setup compile options in client/CMakeList.txt. I don't like this and i prefer not to have to invoke any shell script, so my question is : is there a better method to not go outside cmake ? something like :
add_subdirectory( server )
add_subdirectory( client )
add_subdirectory( client TOOLCHAIN=XXX )