Can CMake generate a configure file?

前端 未结 4 653
忘了有多久
忘了有多久 2020-12-14 10:43

I need the configure file to transpile from C++ to JS, I\'m trying to use emscripten in a project. Emscripten comes with a tool called emconfigure, that replaces the autocon

相关标签:
4条回答
  • 2020-12-14 10:46

    In fact, do not generate a "set", but you can use functions that do everything he does, as is the case of vereficação data types, vereficar headers and more.

    Well, I'll go down a link to my project that contains all those functions. I suggest that a study of it, anything send me an email or something to take your questions.

    Here

    Check too the /deps/cmake folder to view the functions created by us.

    0 讨论(0)
  • 2020-12-14 10:52

    Cmake is a build system. It generates Makefiles. Look here for more information on that. But to answer your question briefly no, you cannot generate configure files with cmake.

    0 讨论(0)
  • 2020-12-14 11:00

    Yes, it can:

    configure_file(<input> <output>
                   [COPYONLY] [ESCAPE_QUOTES] [@ONLY]
                   [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
    

    Example.h.in

    #ifndef EXAMPLE_H
    #define EXAMPLE_H
    
    /*
     * These values are automatically set according to their cmake variables.
     */
    #define EXAMPLE "${EXAMPLE}"
    #define VERSION "${VERSION}"
    #define NUMBER  ${NUMBER}
    
    #endif /* EXAMPLE_H */
    

    In your cmake file:

    set(EXAMPLE "This is an example")
    set(VERSION "1.0")
    set(NUMBER 3)
    
    configure_file(Example.h.in Example.h)
    

    Configured Example.h:

    #ifndef EXAMPLE_H
    #define EXAMPLE_H
    
    /*
     * These values are automatically set according to their cmake variables.
     */
    #define EXAMPLE "This is an example"
    #define VERSION "1.0"
    #define NUMBER  3
    
    #endif /* EXAMPLE_H */
    

    Documentation:

    • CMake 3.0
    • CMake 2.8.12
    0 讨论(0)
  • 2020-12-14 11:09

    yes cmake generates you the files you need to build the project depending on your target platform. however you need to write the CMakelist.txt's files for CMake by yourself or you have to get them from someone else. if emscripten has them and you have cmake installed, go to the root of your cource directory and launch cmake to see a list of arguments you can use

    0 讨论(0)
提交回复
热议问题