Skip to content

Building tng as a subproject in a subdirectory #1

@madebr

Description

@madebr

Hello!

Recently, we received a package inclusion request for tng 1.8.2 at conan-center-index.
It appears tng cannot build correctly when used as a subproject.
This can be fixed by applying the following patch:

--- BuildTNG.cmake
+++ BuildTNG.cmake
@@ -1,9 +1,9 @@
 set(TNG_ROOT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR})
-file(RELATIVE_PATH TNG_ROOT_BINARY_DIR ${CMAKE_SOURCE_DIR} ${TNG_ROOT_SOURCE_DIR})
+file(RELATIVE_PATH TNG_ROOT_BINARY_DIR ${PROJECT_SOURCE_DIR} ${TNG_ROOT_SOURCE_DIR})
 if ("${TNG_ROOT_BINARY_DIR}" MATCHES "^\.\.")
     set(TNG_ROOT_BINARY_DIR tng)
 endif()
-set(TNG_ROOT_BINARY_DIR ${CMAKE_BINARY_DIR}/${TNG_ROOT_BINARY_DIR})
+set(TNG_ROOT_BINARY_DIR ${PROJECT_BINARY_DIR}/${TNG_ROOT_BINARY_DIR})
 
 set(TNG_MAJOR_VERSION "1")
 set(TNG_MINOR_VERSION "8")

I believe this patch would also be useful for the tng library itself.

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