Skip to content

How can I add a compile definition to a subdirectory? #75

Closed

Description

@xtremegamer1

I imagine it should look something like this:

[subdir.asmjit]
compile_definitions = [
    "ASMJIT_STATIC"
]

Activity

  1. gmh5225 commented on Nov 14, 2022

    @gmh5225

    Maybe you could try it this way

    [subdir.asmjit]
    include-before = ["asmjit-static.cmake"]
    

    In asmjit-static.cmake:
    add_definitions(-DASMJIT_STATIC)

  2. mrexodia commented on Nov 14, 2022

    @mrexodia
    Contributor

    Yeah you can do this, but it’s not the correct way to do this. Asmjit has a CMake option to build statically and you should set that instead:

    [subdir.asmjit]
    cmake-before = "set(ASMJIT_STATIC ON)"

    The DEFINED keyword in CMake (confusingly) has nothing to do with compile definitions and instead checks if a CMake variable is defined.

  3. locked and limited conversation to collaborators on Nov 23, 2022
  4. converted this issue into a discussion #76 on Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions