that's actually a good point. Currently as I am developing this i am doing
an out of source build and just testing it from there but eventually what I
want is a shared library that can be used by other programs.

currently though my other programs is just a simple main.c that includes
the main library which includes all the sub libraries.

One of the reasons why I chose to just set the paths as I did was that I
couldn't get the install command to work, not sure why exactly at that time
I was just getting started with cmake so most likely user error. It's been
working so far and the main concern right now is to get this c program
working then refine the cmake build as I go.

I just moved the bin directory to my desktop for testing, that seemed to
work but this is something to keep in mind.

On Thu, Dec 10, 2015 at 4:20 PM, Raymond Wan <rwan.w...@gmail.com> wrote:

> Hi Owen,
>
> Sorry to jump into the discussion, but what you're talking is
> something I was thinking of just recently...
>
> I think the choice between this:
>
>
> On Thu, Dec 10, 2015 at 3:48 PM, Owen Alanzo Hogarth
> <gurenc...@gmail.com> wrote:
> > set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> > set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
> > set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
>
>
> and this:
>
>
> > it seems like this line in your reply above
> > install( TARGETS lib1 lib2 DESTINATION lib )
> > install( FILES lib1/headers/lib1.h lib2/headers/lib2.h DESTINATION
> include )
>
>
> comes down to whether you want to compile other programs with these
> libraries.  If you will not, then you can set the paths to
> CMAKE_BINARY_DIR, which is the path to the top of the build tree.  As
> far as I know, after you compile your program, you can/should delete
> the build tree (i.e., assuming an out-of-source build).
>
> So, most likely, you'd want to pick the second option if you need the
> header files and archives to build something else.  This is because
> when you run cmake, you can set the prefix to install files to (i.e.,
> using "make install").  In my case, I only need header files and
> archives to build something within a single build (i.e., various
> inter-related subdirectories, all under one CMakeLists.txt).  So, I do
> something similar to the first option.
>
> I did toy with the second option a bit but, in the end, realized that
> much of what I wrote won't be reused by another project of mine.  At
> least, that's my understanding of the two options above...
>
> Ray
>
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to