Reputation: 43
Assumption - I have a Generator.bat file which will generate .cpp / .hpp file
I need to write a CMakeList.txt
1.I have couple of Java file say ( A.java and B.Java) 2. If any of the Java file get change , then we need to execute Generator.bat and regenerate the A.cpp and B.cpp and A.hpp and B.hpp files
I need to generate a target DLL , from the generated A.cpp and B.cpp and C.cpp (which is user defined) and D.cpp ( which is user defined)
We need to generate target DLL A) If any of the user defined .cpp file say D.cpp B) if any of the .java file change . Then execute the step 2 and and regenerate the .DLL
Upvotes: 1
Views: 1389
Reputation: 30937
You can use add_custom_command
to teach CMake how to generate your files:
add_custom_command(OUTPUT A.cpp A.hpp B.cpp B.hpp
DEPENDS A.java B.java
COMMAND generator.bat)
add_library(target SHARED A.cpp B.cpp C.cpp D.cpp)
You could have the library depend on A.hpp and B.hpp as well, but you said generator.bat
regenerates them anyway, so that should not be needed...
Upvotes: 2