# problem with find\_package()

**URL:** https://discourse.cmake.org/t/problem-with-find-package/2266
**Category:** Usage
**Created:** [November 30, 2020, 2:05pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266 "2020-11-30T14:05:19Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![kondachaitanya1993](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kondachaitanya1993](https://discourse.cmake.org/u/kondachaitanya1993)
#### Post date: [November 30, 2020, 2:05pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/1 "2020-11-30T14:05:19Z")

</div>

## i am completely new to use cmake. i am facing an issue with debugging the following error.

Observed:

```auto
CMake Error at CMakeLists.txt:30 (find_package):
  find_package called with incorrect number of arguments

 was not found. Please specify vsomeip_DIR
-- Configuring incomplete, errors occurred!

```

* * *

## CMakeLists.txt content:

```cmake
cmake_minimum_required (VERSION 2.8.7)
project (vSomeIPHelloWorld)

find_package(Threads REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(${VSOMEIP_INCLUDE_DIRS})

add_library(vsomeip_hello_world_service INTERFACE)
target_sources(vsomeip_hello_world_service INTERFACE
    "${CMAKE_CURRENT_SOURCE_DIR}/hello_world_service.hpp"
)
target_include_directories(vsomeip_hello_world_service INTERFACE
        "${CMAKE_CURRENT_SOURCE_DIR}"
)

add_library(vsomeip_hello_world_client INTERFACE)
target_sources(vsomeip_hello_world_client INTERFACE
    "${CMAKE_CURRENT_SOURCE_DIR}/hello_world_client.hpp"
)
target_include_directories(vsomeip_hello_world_client INTERFACE
        "${CMAKE_CURRENT_SOURCE_DIR}"
        )

if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
    # This will get us acces to
    # VSOMEIP_INCLUDE_DIRS - include directories for vSomeIP
    # VSOMEIP_LIBRARIES - libraries to link against
    find_package(${VSOMEIP_NAME})
    if (NOT ${VSOMEIP_NAME}_FOUND)
        message("${VSOMEIP_NAME} was not found. Please specify vsomeip_DIR")
    endif()

    add_executable (hello_world_service hello_world_service_main.cpp)
    target_link_libraries(hello_world_service vsomeip_hello_world_service ${VSOMEIP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

    add_executable (hello_world_client hello_world_client_main.cpp)
    target_link_libraries(hello_world_client vsomeip_hello_world_client ${VSOMEIP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()

```

* * *

Kindly help me in resolving the issue.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 30, 2020, 2:12pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/2 "2020-11-30T14:12:32Z")

</div>

> [@kondachaitanya1993](#):
>
> ```auto
> find_package(${VSOMEIP_NAME})
> 
> ```

The error message indicates that you’ve called `find_package` with the wrong number of arguments. What is the value of the `VSOMEIP_NAME` variable?

---

<div class="post-metadata">

### Author: ![kondachaitanya1993](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kondachaitanya1993](https://discourse.cmake.org/u/kondachaitanya1993)
#### Post date: [November 30, 2020, 2:16pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/3 "2020-11-30T14:16:24Z")

</div>

i don’t know how to check the variable value.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 30, 2020, 2:19pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/4 "2020-11-30T14:19:09Z")

</div>

You can use something like:

```cmake
message("-->${VSOMEIP_NAME}<--")

```

with the arrows there to help pinpoint the value.

---

<div class="post-metadata">

### Author: ![kondachaitanya1993](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kondachaitanya1993](https://discourse.cmake.org/u/kondachaitanya1993)
#### Post date: [November 30, 2020, 2:28pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/5 "2020-11-30T14:28:57Z")

</div>

it is displaying nothing as follows

CMake Error at CMakeLists.txt:30 (find\_package):  
find\_package called with incorrect number of arguments

–\>\<–  
was not found. Please specify vsomeip\_DIR  
– Configuring incomplete, errors occurred!

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 30, 2020, 2:43pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/6 "2020-11-30T14:43:03Z")

</div>

That variable is then empty. You’ll need to set it to the name of the package that should be found.

---

<div class="post-metadata">

### Author: ![kondachaitanya1993](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kondachaitanya1993](https://discourse.cmake.org/u/kondachaitanya1993)
#### Post date: [November 30, 2020, 2:46pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/7 "2020-11-30T14:46:17Z")

</div>

okay.  
will try setting the variable.

---

<div class="post-metadata">

### Author: ![kondachaitanya1993](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/f14d63/32.png) [@kondachaitanya1993](https://discourse.cmake.org/u/kondachaitanya1993)
#### Post date: [November 30, 2020, 2:49pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/8 "2020-11-30T14:49:41Z")

</div>

Thanks a lot. It is working after setting the variable value.

---

<div class="post-metadata">

### Author: ![EliasVerstappe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eliasverstappe/32/1253_2.png) [@EliasVerstappe](https://discourse.cmake.org/u/EliasVerstappe)
#### Post date: [March 2, 2021, 10:10am UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/9 "2021-03-02T10:10:46Z")

</div>

Hi @kondachaitanya1993, I have the same problem.  
Could you explain how you set the variable value?  
I’ve tried setting VSOMEIP\_NAME as an environment variable like this: “export VSOMEIP\_NAME=/mnt/c/Users/Elias/wsl/vsomeip/build” (notice I’m using WSL… /vsomeip/build is the directory where I’ve built the vsomeip stack).  
This does not work for me, however.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [March 2, 2021, 4:46pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/10 "2021-03-02T16:46:55Z")

</div>

That variable is a CMake variable. It doesn’t read the environment. You’ll need to add `set(VSOMEIP_NAME …)` to the CMake code, pass `-DVSOMEIP_NAME=…` on the command line, or set the variable in the GUI.

---

<div class="post-metadata">

### Author: ![EliasVerstappe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/eliasverstappe/32/1253_2.png) [@EliasVerstappe](https://discourse.cmake.org/u/EliasVerstappe)
#### Post date: [March 2, 2021, 4:52pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/11 "2021-03-02T16:52:20Z")

</div>

Adding `set(VSOMEIP_NAME …)` in the CMake file indeed fixed it.  
Thanks!

---

<div class="post-metadata">

### Author: ![joseananio](https://discourse.cmake.org/user_avatar/discourse.cmake.org/joseananio/32/1718_2.png) [@joseananio](https://discourse.cmake.org/u/joseananio)
#### Post date: [August 19, 2021, 4:54pm UTC](https://discourse.cmake.org/t/problem-with-find-package/2266/12 "2021-08-19T16:54:55Z")

</div>

For future newbies like me

`VSOMEIP_NAME` is found in your original vsomeip build folder `rootfolder/build/<VSOMEIP_NAME>Config.cmake`

So

`set(VSOMEIP_NAME "vsomeip3")` in my case
