Skip to content

Do not search for PCL components that have been found already - #2428

Merged
SergioRAgostinho merged 1 commit into
PointCloudLibrary:masterfrom
taketwo:fix-2427
Sep 10, 2018
Merged

Do not search for PCL components that have been found already#2428
SergioRAgostinho merged 1 commit into
PointCloudLibrary:masterfrom
taketwo:fix-2427

Conversation

@taketwo

@taketwo taketwo commented Sep 10, 2018

Copy link
Copy Markdown
Member

Fixes #2427.

@jasjuang

jasjuang commented Sep 10, 2018

Copy link
Copy Markdown
Contributor

This fixed the minimal example I mentioned in #2427 but it doesn't completely fix it. Here is another minimal example that induces the same error

CMakeLists.txt

cmake_minimum_required(VERSION 3.11)

add_subdirectory(sample2)
add_subdirectory(sample3)

sample2/CMakeLists.txt

cmake_minimum_required(VERSION 3.11)

project(sample2)

find_package( PCL REQUIRED )

add_library(${PROJECT_NAME} SHARED Sample2.cpp Sample2.h)

target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES})

sample2/Sample2.h

class Sample2{
 public:
  Sample2();
  ~Sample2();
};

sample2/Sample2.cpp

#include "Sample2.h"

Sample2::Sample2() {}

Sample2::~Sample2() {}

sample3/CMakeLists.txt

cmake_minimum_required(VERSION 3.11)

project(sample3)

find_package( PCL REQUIRED )

add_library(${PROJECT_NAME} SHARED Sample3.cpp Sample3.h)

target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES})

sample3/Sample3.h

class Sample3{
 public:
  Sample3();
  ~Sample3();
};

sample3/Sample3.cpp

#include "Sample3.h"

Sample3::Sample3() {}

Sample3::~Sample3() {}

You can see that sample2 and sample3 are irrelevant to each other yet it induces the same cmake error. Gist coming shortly.

@taketwo

taketwo commented Sep 10, 2018

Copy link
Copy Markdown
Member Author

No need for the Gist, I see the problem.

@jasjuang

Copy link
Copy Markdown
Contributor

@taketwo

taketwo commented Sep 10, 2018

Copy link
Copy Markdown
Member Author

OK, I've changed how the "has been found already" test is carried out. Instead of relying on PCL_xxx_FOUND variable (which is not visible across sibling subdirectories) we now check existence of pcl_xxx target.

@jasjuang

Copy link
Copy Markdown
Contributor

Thanks. I tested and it works. Please merge. However, I ran into another separate problem and I will file a separate issue for it.

@SergioRAgostinho
SergioRAgostinho merged commit 6bd7bd1 into PointCloudLibrary:master Sep 10, 2018
@taketwo
taketwo deleted the fix-2427 branch September 10, 2018 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants