apache / celix

Apache Celix is a framework for C and C++14 to develop dynamic modular software applications using component and in-process service-oriented programming.
https://celix.apache.org/
Apache License 2.0
166 stars 87 forks source link

Unknown CMake command "celix_subproject" #586

Closed tonychen0924 closed 1 year ago

tonychen0924 commented 1 year ago

When I camke with "/celix/bundles/shell/shell_tui" , CMake Error : Unknown CMake command "celix_subproject" .

NOTE: cmake celix/examples/celix-examples/hello_world_cxx also has CMake Error : Unknown CMake command "add_celix_bundle" . And add "find_package(Celix REQUIRED)" in CMakeLists.txt to solve .

PengZheng commented 1 year ago

shell_tui is NOT intended for standalone build, neither is hello_world_cxx:

  1. To build tui, you have to build the whole framework. To build/install the Celix framework, follow the steps given in https://github.com/apache/celix/pull/580.
  2. To build hello_world_cxx, you have to build all examples.

    580 also provides guide for building examples standalone.

IMO, building everything as part of Celix project is much easier:

sudo apt-get install -yq --no-install-recommends \
    build-essential \
    git \
    curl \
    uuid-dev \
    libjansson-dev \
    libcurl4-openssl-dev \
    default-jdk \
    libffi-dev \
    libzip-dev \
    libxml2-dev \
    libczmq-dev \
    libcpputest-dev \
    rapidjson-dev

cd celix
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_EXAMPLES:BOOL=ON -DCMAKE_INSTALL_PREFIX=/home/peng/Desktop/celix ..
make -j
make install
cd ../

Does the above include everything you need?

Changing into arbitrary directory and issuing cmake there is not the normal way of using cmake. There are many good tutorials/books on CMake. I suggest you pick one and have a good read.

tonychen0924 commented 1 year ago

Thanks for your advice , because I only build according to document "Building and Installing Apache Celix"

PengZheng commented 1 year ago

Thanks for your advice , because I only build according to document "Building and Installing Apache Celix" When I camke with "/celix/bundles/shell/shell_tui" , CMake Error : Unknown CMake command "celix_subproject" .

If you do follow the documentation, then I'm curious how you get that error. To properly report an issue, a detailed command line history (including the current directory) should be attached.

NOTE: cmake celix/examples/celix-examples/hello_world_cxx also has CMake Error : Unknown CMake command "add_celix_bundle" . And add "find_package(Celix REQUIRED)" in CMakeLists.txt to solve .

You should not add find_package(Celix REQUIRED) to examples/celix-examples/hello_world_cxx/CMakeLists.txt. It seems that you don't follow our documentation or you don't understand how CMake works: Issuingcmake celix/examples/celix-examples/hello_world_cxx is absolutely wrong.

Let me repeat myself, since that is what you are trying to do:

Changing into arbitrary directory and issuing cmake there is not the normal way of using cmake.

Please note that none of your issue reports provides enough backgrounds. I found it really difficult to figure out what your issue is. For example,

When I camke with "/celix/bundles/shell/shell_tui" , CMake Error : Unknown CMake command "celix_subproject" .

What do you mean by "camke with"? Where do you issue the cmake command? If you mean something like cmake /celix/bundles/shell/shell_tui, then you are wrong as I already said above.

You may want to check out the following before opening an github issue: https://stackoverflow.com/questions/240323/how-to-report-bugs-the-smart-way