>     Toplevel
> 
>        |----- CMakeLists.txt
> 
>        |----- src --------|------CMakeLists.txt
> 
>        |                     
> |------common---------------|-------CMakeLists.txt
> 
>        |                      |------dir1-----|                 
>  |------- src1.h
> 
>        |                                          |-----CMakeLists.txt
> 
>        |----bin                                |-----src2.c
> 
>                                                   |-----src3.c

It's quite hard to figure out what's going on here, but I assume src1.h
is under src/common. Please post the output of 'tree' command next time,
if you are on a Unix.

>                 set(src_files src1.h src2.c src3.c)

You don't have to add headers as target dependencies unless you program
in an IDE (just fyi).

>      CMakeLists.txt in common and dir1 are empty.

So, either partially move your CMake scripts into these subdirectories,
or don't do `add_subdirectory()`. For example:

src/CMakeLists.txt:
        add_executable(exec dir1/src1.c dir1/src2.c dir1/src3.c)
        target_include_directories(exec PRIVATE
                "${CMAKE_CURRENT_SOURCE_DIR}/common")

-- 
Alex

Attachment: signature.asc
Description: OpenPGP digital signature

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to