Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 10, 2018

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Sep 10, 2018

Fixes #2427.

@jasjuang
Copy link
Contributor

jasjuang commented Sep 10, 2018

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
Copy link
Member Author

taketwo commented Sep 10, 2018

No need for the Gist, I see the problem.

@jasjuang
Copy link
Contributor

@taketwo
Copy link
Member Author

taketwo commented Sep 10, 2018

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
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.

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