Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] CMake equivalent of QMake "DEFINES"?

[SOLVED] CMake equivalent of QMake "DEFINES"?

Scheduled Pinned Locked Moved Qt Creator and other tools
3 Posts 2 Posters 3.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    postb99
    wrote on 11 Mar 2014, 13:20 last edited by
    #1

    Hello,

    Sorry if this may be off topic or if I was tired of googling before asking here :-)

    Qt Creator generated the following code when creating a shared library project:

    @#if defined(APPLETTUTORIAL1_LIBRARY)

    define APPLETTUTORIAL1SHARED_EXPORT Q_DECL_EXPORT

    #else

    define APPLETTUTORIAL1SHARED_EXPORT Q_DECL_IMPORT

    #endif
    @

    In .pro file I had:

    @DEFINES += APPLETTUTORIAL1_LIBRARY@

    What's the equivalent in CMakeLists.txt? I tried this before "add_library..." but it doesn't work:

    @set_property(TARGET applet-tutorial1 PROPERTY APPLETTUTORIAL1_LIBRARY ON)@

    Thank you

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JohanSolo
      wrote on 12 Mar 2014, 06:56 last edited by JohanSolo
      #2

      According to the documentation you can use

      add_definitions(-DAPPLETTUTORIAL1_LIBRARY)
      

      PS: if your TARGET is the library you're building, I guess the set_property must be called only after the add_library statement.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • P Offline
        P Offline
        postb99
        wrote on 12 Mar 2014, 08:43 last edited by
        #3

        Thank you very much, I added this right before the "add_library" statement and it works as expected :-)

        1 Reply Last reply
        0

        2/3

        12 Mar 2014, 06:56

        • Login

        • Login or register to search.
        2 out of 3
        • First post
          2/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved