Re: [CMake] organizing includes statements

2015-12-10 Thread Owen Alanzo Hogarth
oh cool
adding target_include_directories(lib1 PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/headers)

and then I can just use #include "lib1" where needed. No more of those very
static paths!

Thank you very much!

On Thu, Dec 10, 2015 at 4:08 PM, iosif neitzke <
iosif.neitzke+cm...@gmail.com> wrote:

> I would think
>
> add_library( lib1 SHARED lib1/lib1.c )
> target_include_directories( lib1 PUBLIC lib1/headers )
>
> is simpler.  Are the generator expressions needed for target export
> install commands, and is exporting targets at install preferred to
> add_subdirectory() ?
>
> On Thu, Dec 10, 2015 at 1:48 AM, Owen Alanzo Hogarth
> <gurenc...@gmail.com> wrote:
> > my main CMakeLists.txt file already has a few directives that move the
> libs
> > to an output folder so the binaries go to /bin while static and shared
> > libraries go to /lib
> >
> > 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)
> >
> >
> > it seems like this line in your reply above
> > install( TARGETS lib1 lib2 DESTINATION lib )
> >
> > moves the shared libraries to the lib folder and this line below moves
> the
> > header files to the newly created include directory.
> >
> > install( FILES lib1/headers/lib1.h lib2/headers/lib2.h DESTINATION
> include )
> >
> > is that right?
> >
> > On Thu, Dec 10, 2015 at 1:46 PM, Attila Krasznahorkay
> > <attila.krasznahor...@gmail.com> wrote:
> >>
> >> Hi Owen,
> >>
> >> This seems like a textbook example of using
> target_include_directories(…)
> >> with generator expressions. Let’s take the example where:
> >>
> >> lib1/headers/lib1.h
> >> lib1/lib1.c
> >> lib2/headers/lib2.h
> >> lib2/lib2.c
> >>
> >> If you want to be able to include lib1.h and lib2.h with simply
> >>
> >> #include “lib1.h”
> >>
> >> and
> >>
> >> #include “lib2.h”
> >>
> >> in your user code, and in the library code itself, you’d do something
> >> like:
> >>
> >> add_library( lib1 SHARED lib1/lib1.c )
> >> target_include_directories( lib1 PUBLIC
> >>$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib1/headers>
> >>$ )
> >>
> >> add_library( lib2 SHARED lib2/lib2.c )
> >> target_include_directories( lib2 PUBLIC
> >>$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib2/headers>
> >>$ )
> >> target_link_libraries( lib2 lib1 )
> >>
> >> install( FILES lib1/headers/lib1.h lib2/headers/lib2.h DESTINATION
> include
> >> )
> >> install( TARGETS lib1 lib2 DESTINATION lib )
> >>
> >> In this setup “lib1” should get a -I${CMAKE_SOURCE_DIR}/lib1/headers
> flag,
> >> and “lib2” should get both -I${CMAKE_SOURCE_DIR}/lib1/headers and
> >> -I${CMAKE_SOURCE_DIR}/lib2/headers. Finally the headers both get
> installed
> >> into the same include directory, so an outside user will just have to be
> >> able to find that one directory. (Or if you export CMake’s targets, the
> >> lib1/2 imported targets will know that their header files are in that
> >> directory.)
> >>
> >> Cheers,
> >> Attila
> >>
> >> > On Dec 10, 2015, at 12:07 AM, Owen Alanzo Hogarth <
> gurenc...@gmail.com>
> >> > wrote:
> >> >
> >> > hi
> >> >
> >> > I am building a shared library project that's composed of many smaller
> >> > shared library files.
> >> >
> >> > Here's the main shared library project and a list of all the sub
> >> > projects.
> >> >
> >> > SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/main_lib.h)
> >> > SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main_lib.c)
> >> > SET(TARGET_LIBS core_math point2d line2d quad2d timer_utils)
> >> >
> >> > ADD_LIBRARY(main_lib SHARED ${SRC_FILES} ${HEADER_FILES})
> >> > TARGET_LINK_LIBRARIES(core_engine ${TARGET_LIBS})
> >> >
> >> > i have each module setup like this.
> >> > module
> >> > module/headers/module.h
> >> > module/module.c
> >> >
> >> > then the module.c will look like this
> >> > #include "headers/module.h"
> >> >
> >> > the file main_lib.h depends on all those target libs, which makes my
> >>

Re: [CMake] organizing includes statements

2015-12-10 Thread Owen Alanzo Hogarth
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

[CMake] organizing includes statements

2015-12-09 Thread Owen Alanzo Hogarth
hi

I am building a shared library project that's composed of many smaller
shared library files.

Here's the main shared library project and a list of all the sub projects.

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/main_lib.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main_lib.c)
SET(TARGET_LIBS core_math point2d line2d quad2d timer_utils)

ADD_LIBRARY(main_lib SHARED ${SRC_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(core_engine ${TARGET_LIBS})

i have each module setup like this.
module
module/headers/module.h
module/module.c

then the module.c will look like this
#include "headers/module.h"

the file main_lib.h depends on all those target libs, which makes my
main_lib.h file's include statement look like this

#include "../../module/headers/module.h"
#include "../../module1/headers/module1.h"
#include "../../module2/headers/module2.h"


is there any way that I can clean up these includes?

For example if I want to use io functions I can just do #include 
or #include 

for math functions.

I would like to make my include statements not relative to the files actual
location, the way it's currently hard coded.
-- 

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

Re: [CMake] organizing includes statements

2015-12-09 Thread Owen Alanzo Hogarth
my main CMakeLists.txt file already has a few directives that move the libs
to an output folder so the binaries go to /bin while static and shared
libraries go to /lib

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)


it seems like this line in your reply above
install( TARGETS lib1 lib2 DESTINATION lib )

moves the shared libraries to the lib folder and this line below moves the
header files to the newly created include directory.

install( FILES lib1/headers/lib1.h lib2/headers/lib2.h DESTINATION include )

is that right?

On Thu, Dec 10, 2015 at 1:46 PM, Attila Krasznahorkay <
attila.krasznahor...@gmail.com> wrote:

> Hi Owen,
>
> This seems like a textbook example of using target_include_directories(…)
> with generator expressions. Let’s take the example where:
>
> lib1/headers/lib1.h
> lib1/lib1.c
> lib2/headers/lib2.h
> lib2/lib2.c
>
> If you want to be able to include lib1.h and lib2.h with simply
>
> #include “lib1.h”
>
> and
>
> #include “lib2.h”
>
> in your user code, and in the library code itself, you’d do something like:
>
> add_library( lib1 SHARED lib1/lib1.c )
> target_include_directories( lib1 PUBLIC
>$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib1/headers>
>$ )
>
> add_library( lib2 SHARED lib2/lib2.c )
> target_include_directories( lib2 PUBLIC
>$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/lib2/headers>
>$ )
> target_link_libraries( lib2 lib1 )
>
> install( FILES lib1/headers/lib1.h lib2/headers/lib2.h DESTINATION include
> )
> install( TARGETS lib1 lib2 DESTINATION lib )
>
> In this setup “lib1” should get a -I${CMAKE_SOURCE_DIR}/lib1/headers flag,
> and “lib2” should get both -I${CMAKE_SOURCE_DIR}/lib1/headers and
> -I${CMAKE_SOURCE_DIR}/lib2/headers. Finally the headers both get installed
> into the same include directory, so an outside user will just have to be
> able to find that one directory. (Or if you export CMake’s targets, the
> lib1/2 imported targets will know that their header files are in that
> directory.)
>
> Cheers,
> Attila
>
> > On Dec 10, 2015, at 12:07 AM, Owen Alanzo Hogarth <gurenc...@gmail.com>
> wrote:
> >
> > hi
> >
> > I am building a shared library project that's composed of many smaller
> shared library files.
> >
> > Here's the main shared library project and a list of all the sub
> projects.
> >
> > SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/main_lib.h)
> > SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/main_lib.c)
> > SET(TARGET_LIBS core_math point2d line2d quad2d timer_utils)
> >
> > ADD_LIBRARY(main_lib SHARED ${SRC_FILES} ${HEADER_FILES})
> > TARGET_LINK_LIBRARIES(core_engine ${TARGET_LIBS})
> >
> > i have each module setup like this.
> > module
> > module/headers/module.h
> > module/module.c
> >
> > then the module.c will look like this
> > #include "headers/module.h"
> >
> > the file main_lib.h depends on all those target libs, which makes my
> main_lib.h file's include statement look like this
> >
> > #include "../../module/headers/module.h"
> > #include "../../module1/headers/module1.h"
> > #include "../../module2/headers/module2.h"
> >
> >
> > is there any way that I can clean up these includes?
> >
> > For example if I want to use io functions I can just do #include
>  or #include 
> >
> > for math functions.
> >
> > I would like to make my include statements not relative to the files
> actual location, the way it's currently hard coded.
> > --
> >
> > 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
>
>
-- 

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

[CMake] adding gprof to cmake project

2015-11-29 Thread Owen Alanzo Hogarth
I have a project with many libs and one executable.

I read this email exchange:
https://cmake.org/pipermail/cmake/2009-December/033979.html

 on adding linker flags but this was from around 2009 and things most
likely have changed a lot since then.

in my executable my cmakelists.txt looks like this

SET(CMAKE_MACOSX_RPATH 1)

FIND_PACKAGE(SDL2 REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
INCLUDE_DIRECTORIES( ${OPENGL_INCLUDE_DIR} ${SDL2_INCLUDE_DIR})

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/core_engine.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/core_engine.c)
SET(TARGET_LIBS ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} core_math
default_shader_2D renderable_2D cam_2d resource_utils timer_utils)

SET(CMAKE_C_FLAGS "-Wall -pg ${CMAKE_C_FLAGS}")
SET(CMAKE_EXE_LINKER_FLAGS "-Wall -pg ${CMAKE_EXE_LINKER_FLAGS}")

ADD_LIBRARY(core_engine SHARED ${SRC_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(core_engine ${TARGET_LIBS})

i've set the cmake_c_flags as well as the cmake_exe_linker_flags but I
still can't get the output from my executable after running cmake.

How can I add the proper flags?
-- 

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

[CMake] find___.cmake module

2015-11-08 Thread Owen Alanzo Hogarth
HI

I am having some issue getting my findSDL2_image.cmake module to work.
I moved to linux and the strict character case is causing me a lot of
trouble.

Here is the error when running the cmake build script


  Argument not separated from preceding token by whitespace.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Could NOT find SDL2_image (missing:  SDL2_IMAGE_LIBRARIES
SDL2_IMAGE_INCLUDE_DIRS)
message SDL2_IMAGE_INCLUDE_DIR-NOTFOUND
CMake Error: The following variables are used in this project, but they are
set to NOTFOU
ND.
Please set them or make sure they are set and tested correctly in the CMake
files:
SDL2_IMAGE_INCLUDE_DIR (ADVANCED)
   used as include directory in directory
../resource_utils
SDL2_IMAGE_LIBRARY (ADVANCED)
linked by target "resource_utils" in directory
../utils/resource_utils


Here is the cmakelists file

SET(CMAKE_MACOSX_RPATH 1)

FIND_PACKAGE(SDL2 REQUIRED)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})

FIND_PACKAGE(SDL2_image)
INCLUDE_DIRECTORIES(${SDL2_image_INCLUDE_DIR})

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/headers/resource_utils.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/resource_utils.c)
SET(TARGET_LIBS ${SDL2_LIBRARY} ${SDL2_image_LIBRARY})

ADD_LIBRARY(resource_utils ${SRC_FILES} ${HEADER_FILES})
TARGET_LINK_LIBRARIES(resource_utils ${TARGET_LIBS})


the .cmake file is named: FindSDL2_image.cmake and it's in my cmake_modules
path. This is the contents of that file

# Locate SDL2_image library
# This module defines
# SDL2_IMAGE_LIBRARY, the name of the library to link against
# SDL2_IMAGE_FOUND, if false, do not try to link to SDL2_image
# SDL2_IMAGE_INCLUDE_DIR, where to find SDL_image.h
#
# Additional Note: If you see an empty SDL2_IMAGE_LIBRARY_TEMP in your
configuration
# and no SDL2_IMAGE_LIBRARY, it means CMake did not find your SDL2_Image
library
# (SDL2_image.dll, libsdl2_image.so, SDL2_image.framework, etc).
# Set SDL2_IMAGE_LIBRARY_TEMP to point to your SDL2 library, and configure
again.
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
# as appropriate. These values are used to generate the final
SDL2_IMAGE_LIBRARY
# variable, but when these values are unset, SDL2_IMAGE_LIBRARY does not
get initialized.
#
# $SDL2 is an environment variable that would
# correspond to the ./configure --prefix=$SDL2
# used in building SDL2.
# l.e.galup 9-20-02
#
# Modified by Eric Wing.
# Added code to assist with automated building by using environmental
variables
# and providing a more controlled/consistent search behavior.
# Added new modifications to recognize OS X frameworks and
# additional Unix paths (FreeBSD, etc).
# Also corrected the header search path to follow "proper" SDL2 guidelines.
# Added a search for SDL2main which is needed by some platforms.
# Added a search for threads which is needed by some platforms.
# Added needed compile switches for MinGW.
#
# On OSX, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SDL2_IMAGE_LIBRARY to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
#
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
# This needed to change because "proper" SDL2 convention
# is #include "SDL.h", not . This is done for portability
# reasons because not all systems place things in SDL2/ (see FreeBSD).
#
# Ported by Johnny Patterson. This is a literal port for SDL2 of the
FindSDL.cmake
# module with the minor edit of changing "SDL" to "SDL2" where necessary.
This
# was not initialized for redistribution, and exists temporarily pending
official
# SDL2 CMake modules.
#
# Note that on windows this will only search for the 32bit libraries, to
search
# for 64bit change x86/i686-w64 to x64/x86_64-w64

#=
# Copyright 2003-2009 Kitware, Inc.
#
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2014 Kitware, Inc.
# Copyright 2000-2011 Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED 

[CMake] find module configuration not found

2015-11-03 Thread Owen Alanzo Hogarth
I just ran into some difficulties.

I migrated a development system to debian 8.

I had a project on mac os x that built w/ no problems now I am running my
cmake but I get this error:

CMake Error at CMakeLists.txt:4 (FIND_PACKAGE):
  By not providing "FindOPENGL.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "OPENGL", but
  CMake did not find one.

  Could not find a package configuration file provided by "OPENGL" with any
  of the following names:

OPENGLConfig.cmake
opengl-config.cmake

  Add the installation prefix of "OPENGL" to CMAKE_PREFIX_PATH or set
  "OPENGL_DIR" to a directory containing one of the above files.  If
"OPENGL"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

now it seems finding opengl was a deffault config file on mac os x but not
so on linux.

I have cmake 3.0.2-1 installed.
-- 

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

Re: [CMake] find module configuration not found

2015-11-03 Thread Owen Alanzo Hogarth
That was definitely the problem. I had the wrong case This is something.

One more question. Now I am getting a error:

loop initial declarations are only allowed in C99

it's great that the compiler is watching out for me but I do want to stick
to the C99 standard. All my code is formatted that way, how can I set it so
that cmake passes that flag for this whole project?

Do I have to add something to each CMakeLists.txt?



On Tue, Nov 3, 2015 at 9:34 PM, Petr Kmoch <petr.km...@gmail.com> wrote:

> Hi Owen,
>
> the find module which comes with CMake is called FindOpenGL, and is
> supposed to be used as:
>
> find_package(OpenGL ...)
>
> Note the case. From the error messages, it seems you're calling
> find_package(OPENGL). This could work on a case-insensitive system (which I
> believe Mac OS X uses by default), but would definitely not work on a
> case-sensitive one such as normal Linux filesystems.
>
> Petr
>
> On Tue, Nov 3, 2015 at 2:11 PM, Owen Alanzo Hogarth <gurenc...@gmail.com>
> wrote:
>
>> I just ran into some difficulties.
>>
>> I migrated a development system to debian 8.
>>
>> I had a project on mac os x that built w/ no problems now I am running my
>> cmake but I get this error:
>>
>> CMake Error at CMakeLists.txt:4 (FIND_PACKAGE):
>>   By not providing "FindOPENGL.cmake" in CMAKE_MODULE_PATH this project
>> has
>>   asked CMake to find a package configuration file provided by "OPENGL",
>> but
>>   CMake did not find one.
>>
>>   Could not find a package configuration file provided by "OPENGL" with
>> any
>>   of the following names:
>>
>> OPENGLConfig.cmake
>> opengl-config.cmake
>>
>>   Add the installation prefix of "OPENGL" to CMAKE_PREFIX_PATH or set
>>   "OPENGL_DIR" to a directory containing one of the above files.  If
>> "OPENGL"
>>   provides a separate development package or SDK, be sure it has been
>>   installed.
>>
>>
>> -- Configuring incomplete, errors occurred!
>>
>> now it seems finding opengl was a deffault config file on mac os x but
>> not so on linux.
>>
>> I have cmake 3.0.2-1 installed.
>>
>>
>> --
>>
>> 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
>>
>
>
-- 

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

Re: [CMake] getting paths of header files

2015-10-19 Thread Owen Alanzo Hogarth
Some additional info.

Here is my cmakelists.txt for the vector3_scalar module:
PROJECT(vector3_scalar)
SET(CMAKE_MACOSX_RPATH 1)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../common)

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../common/common_structs.h)
SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/vector3_scalar.c
${HEADER_FILES})

ADD_LIBRARY(vector3_scalar SHARED ${SRC_FILES})


now my cmakelists.txt for my matrix4_scalar module. This one depends on
vector3_scalar

PROJECT(matrix4_scalar)
SET(CMAKE_MACOSX_RPATH 1)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../common
${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar
${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers)

SET(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../common/common_structs.h
${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers/vector3_scalar.h
${CMAKE_CURRENT_SOURCE_DIR}/headers/matrix4_scalar.h)

SET(SRC_FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/matrix4_scalar.c
${HEADER_FILES})

ADD_LIBRARY(matrix4_scalar SHARED ${SRC_FILES})

TARGET_LINK_LIBRARIES(matrix4_scalar vector3_scalar)

I am having trouble because when running cmake I get this error that says
no rule to make target

Scanning dependencies of target vector3_scalar
[ 25%] Building C object
source/core_math/vector3_scalar/CMakeFiles/vector3_scalar.dir/sr
c/vector3_scalar.c.o
[ 50%] Linking C shared library
$(CMAKE_BINARY_DIR)/lib/libvector3_scalar.dylib
[ 50%] Built target vector3_scalar
Scanning dependencies of target matrix4_scalar
[ 75%] Building C object
source/core_math/matrix4_scalar/CMakeFiles/matrix4_scalar.dir/sr
c/matrix4_scalar.c.o
make[2]: *** No rule to make target
`source/core_math/vector3_scalar//Users/blubee/SDL/pr
oject/build/lib/libvector3_scalar.dylib', needed by
`source/core_math/matrix4_scalar//Use
rs/blubee/SDL/project/build/lib/libmatrix4_scalar.dylib'.  Stop.
make[1]: ***
[source/core_math/matrix4_scalar/CMakeFiles/matrix4_scalar.dir/all] Error 2
make: *** [all] Error 2




On Mon, Oct 19, 2015 at 5:58 AM, Owen Alanzo Hogarth <gurenc...@gmail.com>
wrote:

> I am having some trouble with my cmake build. I recently redesigned the
> physical layout of my files so that it'll be a bit easier to maintain in
> the long run.
>
> I have my project structure setup like this.
>
> MAIN_PROJECT/
> project/main.c # this is the executable
> resources/...# a folder filled with resources
> source/
> source/moduleA/moduleA.h #includes all headers for this module
>  #a user would just import
> moduleA.h
>
> source/moduleA/headers/header1.h header2.h
> source/moduleA/src/source1.c  source2.c
> source/moduleA/common/common_structs.h #holds common structs for
>
> #all src files in this module
>
>
> with my project re-organized like this and try to build my shared
> libraries I get no output.
>
> For example main cmakelists.txt file
>
> PROJECT(project)
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
>
> 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)
>
> SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)
>
> ADD_SUBDIRECTORY(source)
>
> FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources/ DESTINATION
> ${CMAKE_CURRENT_BINARY_DIR}/bin/resources/)
>
> this is one module within the source folder, a matrix4
>
> PROJECT(matrix4_scalar)
>
> INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../common")
>
> INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers/vector3_scalar.h")
>
> SET(HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../common/common_structs.h"
> "${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers/vector3_scalar.h")
>
>
> SET(SRC_FILES src/matrix4_scalar.c ${HEADER_FILES})
>
> ADD_LIBRARY(matrix4_scalar SHARED ${SRC_FILES})
>
> TARGET_LINK_LIBRARIES(matrix4_scalar vector3_scalar)
>
>
>
> The vector3 class is built in a similar way but has no outside
> dependencies except for the common_struct.h header file.
>
> This matrix class depends on the vector3 class so I have it as a target
> link library.
>
> When I build like this I get no output to my lib directories and I am not
> sure what's going on.
>
-- 

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

Re: [CMake] linking hared libraries

2015-10-19 Thread Owen Alanzo Hogarth
You made a few points that I have not seen before specifically using
$<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and

$<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>


Where are these commands, I just did a search and found a mailing list
that said they will override include_directories but I haven't seen
them before, especially in any of the tutorials that i've read on the
cmake site.


Also you said the PROJECT() should only be defined once, but shouldn't
each cmakelists.txt contain a project() or else cmake complains at me.


Hej,

A quick glance doesn't show anything out of the ordinary, except that
* I'd prevent any use of `..` in your folder references (by using things
like $<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and
$<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>
* I think it is more or less standard practice now to _not_ use
'include_directories', but instead use target_include_directories()
* you do add_subdirectory(source), but don't show the lists-file in that
folder, which may cause the problem you're seeing

The first thing I see that seems really wrong though, is that you type the
'project()' command twice. AFAIK you're supposed to use this command
exactly once, to set the properties of the entire project. Using it
multiple times causes undefined behaviour, and may very well be the cause
for what you're seeing

Sincerely,
Jakob


On Mon, Oct 19, 2015 at 5:43 PM, Owen Alanzo Hogarth <gurenc...@gmail.com>
wrote:

> Hi guys
>
> Can I get some help with this question I have. I did a really thorough
> writeup here on SO:
> http://stackoverflow.com/questions/33209659/cmake-no-rule-to-make-target-for-internal-shared-library?noredirect=1#comment54224377_33209659
>
-- 

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

[CMake] linking hared libraries

2015-10-19 Thread Owen Alanzo Hogarth
Hi guys

Can I get some help with this question I have. I did a really thorough
writeup here on SO:
http://stackoverflow.com/questions/33209659/cmake-no-rule-to-make-target-for-internal-shared-library?noredirect=1#comment54224377_33209659
-- 

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

Re: [CMake] linking hared libraries

2015-10-19 Thread Owen Alanzo Hogarth
Ray

Thanks, removing them from the sub projects didn't cause any issues,
although I am still having the issue with either a no rule to make target
error or if I remove the header I get a linking error:
http://stackoverflow.com/questions/33209659/cmake-no-rule-to-make-target-for-internal-shared-library?noredirect=1#comment54229598_33209659


On Mon, Oct 19, 2015 at 9:48 PM, Raymond Wan <rwan.w...@gmail.com> wrote:

> Hi Owen,
>
>
> On Mon, Oct 19, 2015 at 8:43 PM, Owen Alanzo Hogarth
> <gurenc...@gmail.com> wrote:
> > Also you said the PROJECT() should only be defined once, but shouldn't
> each
> > cmakelists.txt contain a project() or else cmake complains at me.
>
>
> According to the last paragraph of:
>
> https://cmake.org/cmake/help/v3.0/command/project.html
>
> you only need a PROJECT () in the top-level CMakeLists.txt...
>
> 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

Re: [CMake] linking hared libraries

2015-10-19 Thread Owen Alanzo Hogarth
also one more question.

I have a few header only files one in
common/common_structs.h

and
core_math/core_math.h

These files aren't compiled anywhere, they are just used as header only
files that I will eventually use to link in different versions of the
matrix and vector classes. For example I can have scalar math modules, sse
math modules or neon math modules. Depending on compiler flags those header
files will compile and include different versions, without changing the
public interface.

How can I handle that?

I still cannot find much information on using these constructs in my cmake
files.

$<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES>


On Mon, Oct 19, 2015 at 8:43 PM, Owen Alanzo Hogarth <gurenc...@gmail.com>
wrote:

> You made a few points that I have not seen before specifically using 
> $<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and
>
> $<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>
>
>
> Where are these commands, I just did a search and found a mailing list that 
> said they will override include_directories but I haven't seen them before, 
> especially in any of the tutorials that i've read on the cmake site.
>
>
> Also you said the PROJECT() should only be defined once, but shouldn't each 
> cmakelists.txt contain a project() or else cmake complains at me.
>
>
> Hej,
>
> A quick glance doesn't show anything out of the ordinary, except that
> * I'd prevent any use of `..` in your folder references (by using things
> like $<TARGET_PROPERTY:vector3_scalar,INCLUDE_DIRECTORIES> and
> $<TARGET_PROPERTY:vector3_scalar,INTERFACE_INCLUDE_DIRECTORIES>
> * I think it is more or less standard practice now to _not_ use
> 'include_directories', but instead use target_include_directories()
> * you do add_subdirectory(source), but don't show the lists-file in that
> folder, which may cause the problem you're seeing
>
> The first thing I see that seems really wrong though, is that you type the
> 'project()' command twice. AFAIK you're supposed to use this command
> exactly once, to set the properties of the entire project. Using it
> multiple times causes undefined behaviour, and may very well be the cause
> for what you're seeing
>
> Sincerely,
> Jakob
>
>
> On Mon, Oct 19, 2015 at 5:43 PM, Owen Alanzo Hogarth <gurenc...@gmail.com>
> wrote:
>
>> Hi guys
>>
>> Can I get some help with this question I have. I did a really thorough
>> writeup here on SO:
>> http://stackoverflow.com/questions/33209659/cmake-no-rule-to-make-target-for-internal-shared-library?noredirect=1#comment54224377_33209659
>>
>
>
-- 

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

Re: [CMake] providing host binary and target library cmake-package when cross compiling

2015-10-19 Thread Owen Alanzo Hogarth
This is the entire project as it stands right now. I have tried changing
from using relative to more absolute directory names in my project but I
still get the same build errors.

This pastebin has all the relevant code: http://pastebin.com/BnVTnegP

Anyone can see anything wrong with this?

On Mon, Oct 19, 2015 at 10:11 PM, Pascal Bach 
wrote:

> Hello
>
> I'm working on CMake support for Apache Thrift [1].
> It is currently already buildable using CMake. However while trying to add
> support for generating a ThriftConfig.cmake I ran into some issues
> related to cross compilation.
>
> Thrift has the following components relevant to the problem:
>
> C++ library (.so library)
> Thrift compiler (binary)
>
> End users/developers usually us thrift in the following way:
> Thrift IDL ==[Thrift compiler]==> C++ files ==[GCC + Link with
> thrift.so]==> final.so
>
> My idea for the resulting ThriftConfig.cmake was to provide two imported
> targets Thrift::libthrift and Thrift::compiler.
> Thrift::compiler can be used to generate C++ files from Thrift IDLs and
> Thrift::libthrift is what the resulting binary should link against.
> This works well if no cross compilation is involved.
>
>
> Now for the cross compilation case. I'm using OpenEmbedded [2] which
> provides two sysroot directories:
> 1. sysroot_x86 containing binaries and libraries for the host:
> libthrift.so (x86 library), thrift (x86 executable)
> 2. sysroot_arm containing binaries and libraries for the target:
> libthrift.so (arm library), thrift (arm executable)
>
> In the cross compiling case the Thrift::compiler target must be executable
> on the HOST and Thrift::libthrift must be a target library.
> This means the library should be from sysroot_arm but the binary from
> sysroot_x86.
> I'm not able express this an a good way.
>
> Does anyone know how to do this? Is there an example how this could be
> done?
>
> Thanks for your help.
>
> Regards
> Pascal
>
>
> [1] http://thrift.apache.org/
> [2] http://www.openembedded.org/wiki/Main_Page
> --
>
> 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
>
-- 

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

Re: [CMake] providing host binary and target library cmake-package when cross compiling

2015-10-19 Thread Owen Alanzo Hogarth
this is not an in source build.

to do matrix vector multiplication matrix module needs to have access to
the vector class.


I'll add the source code for these modules here:
http://pastebin.com/aj01ycRQ

I think the structure should be a little clearer with all that I've
provided.
This is the previous link to the cmake folder structure and cmakelists.txt
files: http://pastebin.com/BnVTnegP


On Tue, Oct 20, 2015 at 12:33 AM, Hendrik Sattler <p...@hendrik-sattler.de>
wrote:

>
>
> Am 19. Oktober 2015 17:33:55 MESZ, schrieb Owen Alanzo Hogarth <
> gurenc...@gmail.com>:
> >This is the entire project as it stands right now. I have tried
> >changing
> >from using relative to more absolute directory names in my project but
> >I
> >still get the same build errors.
> >
> >This pastebin has all the relevant code: http://pastebin.com/BnVTnegP
>
> a.
> You user in-source build, don't do that.
>
> b.
> You have the vector3 target defined in the matrix4 folder and vice versa?
> Why?
>
> c.
> Because of b. the targets are defined in wrong order. That's why he tries
> to find a library that is not present.
>
> >Anyone can see anything wrong with this?
> >
> >On Mon, Oct 19, 2015 at 10:11 PM, Pascal Bach <pascal.b...@siemens.com>
> >wrote:
> >
> >> Hello
> >>
> >> I'm working on CMake support for Apache Thrift [1].
> >> It is currently already buildable using CMake. However while trying
> >to add
> >> support for generating a ThriftConfig.cmake I ran into some issues
> >> related to cross compilation.
> >>
> >> Thrift has the following components relevant to the problem:
> >>
> >> C++ library (.so library)
> >> Thrift compiler (binary)
> >>
> >> End users/developers usually us thrift in the following way:
> >> Thrift IDL ==[Thrift compiler]==> C++ files ==[GCC + Link with
> >> thrift.so]==> final.so
> >>
> >> My idea for the resulting ThriftConfig.cmake was to provide two
> >imported
> >> targets Thrift::libthrift and Thrift::compiler.
> >> Thrift::compiler can be used to generate C++ files from Thrift IDLs
> >and
> >> Thrift::libthrift is what the resulting binary should link against.
> >> This works well if no cross compilation is involved.
> >>
> >>
> >> Now for the cross compilation case. I'm using OpenEmbedded [2] which
> >> provides two sysroot directories:
> >> 1. sysroot_x86 containing binaries and libraries for the host:
> >> libthrift.so (x86 library), thrift (x86 executable)
> >> 2. sysroot_arm containing binaries and libraries for the target:
> >> libthrift.so (arm library), thrift (arm executable)
> >>
> >> In the cross compiling case the Thrift::compiler target must be
> >executable
> >> on the HOST and Thrift::libthrift must be a target library.
> >> This means the library should be from sysroot_arm but the binary from
> >> sysroot_x86.
> >> I'm not able express this an a good way.
> >>
> >> Does anyone know how to do this? Is there an example how this could
> >be
> >> done?
> >>
> >> Thanks for your help.
> >>
> >> Regards
> >> Pascal
> >>
> >>
> >> [1] http://thrift.apache.org/
> >> [2] http://www.openembedded.org/wiki/Main_Page
> >> --
> >>
> >> 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
> >>
> >
> >
> >
>
> --
>
> 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 Su

[CMake] getting paths of header files

2015-10-18 Thread Owen Alanzo Hogarth
I am having some trouble with my cmake build. I recently redesigned the
physical layout of my files so that it'll be a bit easier to maintain in
the long run.

I have my project structure setup like this.

MAIN_PROJECT/
project/main.c # this is the executable
resources/...# a folder filled with resources
source/
source/moduleA/moduleA.h #includes all headers for this module
 #a user would just import
moduleA.h

source/moduleA/headers/header1.h header2.h
source/moduleA/src/source1.c  source2.c
source/moduleA/common/common_structs.h #holds common structs for

#all src files in this module


with my project re-organized like this and try to build my shared libraries
I get no output.

For example main cmakelists.txt file

PROJECT(project)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

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)

SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

ADD_SUBDIRECTORY(source)

FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources/ DESTINATION
${CMAKE_CURRENT_BINARY_DIR}/bin/resources/)

this is one module within the source folder, a matrix4

PROJECT(matrix4_scalar)

INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../common")
INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers/vector3_scalar.h")

SET(HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../common/common_structs.h"
"${CMAKE_CURRENT_SOURCE_DIR}/../vector3_scalar/headers/vector3_scalar.h")


SET(SRC_FILES src/matrix4_scalar.c ${HEADER_FILES})

ADD_LIBRARY(matrix4_scalar SHARED ${SRC_FILES})

TARGET_LINK_LIBRARIES(matrix4_scalar vector3_scalar)



The vector3 class is built in a similar way but has no outside dependencies
except for the common_struct.h header file.

This matrix class depends on the vector3 class so I have it as a target
link library.

When I build like this I get no output to my lib directories and I am not
sure what's going on.
-- 

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

[CMake] setting up a library with cmake

2015-08-13 Thread Owen Alanzo Hogarth
I initially setup a project like this:

PROJECT/
.../build/
.../cmake_modules/
.../resources/
.../source/ -- subfolders under sources are shared
libs
.../source/components/
.../source/core_math/
.../source/ren_opengl/
.../source/utils/
.../source/main.c -- main() and imported all the shared libs

this setup worked great now I wanted to add another layer to this project

I want to add a top level folder that would contain the project
PROJECT/
.../build/
.../cmake_modules/
*.../project/  -- want to move main here*
.../project/game.c
.../project/game.h
.../resources/
.../source/ -- subfolders under sources are shared
libs
.../source/components/
.../source/core_math/
.../source/ren_opengl/
.../source/utils/
.../source/main.c -- main() and imported all the shared libs

I want to move the main application starter from under the sources folder
to it's own folder under the project sub folder and be able to just import
say main_libs.h

which would in turn bring all the functions that I described in the
sources/ part of the tree.

How can I accomplish this with cmake?

This is what the main.c cmakelists file looks like atm. This is the
cmakelists.txt that starts the whole build down through all the dynamic
libs. Each dynamic lib folder just has a .h .c and maybe some simple header
includes.

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(main)

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)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modules)

FIND_PACKAGE(SDL2 REQUIRED)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})


INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/core_math)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/utils/time_utils)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/utils/resource_utils)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/ren_opengl)
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/components/renderable2d)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/source/glm/vec3.hpp)

FIND_PACKAGE(SDL2 REQUIRED)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR})

REQUIRED_VARS SDL2_IMAGE_LIBRARY SDL2_IMAGE_INCLUDE_DIR)
FIND_PACKAGE(SDL2_IMAGE)
INCLUDE_DIRECTORIES(${SDL2_IMAGE_INCLUDE_DIR})

ADD_SUBDIRECTORY(source)
ADD_SUBDIRECTORY(project) //my attempt to add the new directory

SET(SRC_FILES main.c)
SET(EXTERNAL_TARGET_LIBS ${SDL2_LIBRARY} ${SDL2_IMAGE_LIBRARY})
SET(COMPONENTS renderable2d)
SET(INTERNAL_TARGET_LIBS core_math time_utils resource_utils ren_opengl)

SET(TARGET_LIBS ${INTERNAL_TARGET_LIBS} ${EXTERNAL_TARGET_LIBS}
${COMPONENTS})

ADD_EXECUTABLE(blulauncher ${SRC_FILES})
TARGET_LINK_LIBRARIES(blulauncher ${TARGET_LIBS})


FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/resources/ DESTINATION
${CMAKE_CURRENT_BINARY_DIR}/bin/resources/)
-- 

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

[CMake] passing a list of files from c source code to cmake

2015-08-05 Thread Owen Alanzo Hogarth
I know it's possible to send variables into your c source code from the
cmake tutorials where you set the version.

let's say in your c source code you access some resource files that are
located in your source tree under a resources folder.

I can put those in some type of array in my c source code. Now is it
possible to send that list back to cmake at build time so that it can copy
those files to the binary tree on each build?
-- 

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

[CMake] cmake output files and different platforms.

2015-08-04 Thread Owen Alanzo Hogarth
I am having a bit of trouble getting this sorted out.

I set
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

in one of my cmakelists.txt file and it works almost as expected. If I use
the terminal to build everything goes where it needs to and then I can
reference the relative location of my files and folders from my c code BUT

if I use xcode to build the same program, xcode seems to append a Debug or
Release to the end of my path breaking all my c code.

sample output below
//terminal
///Users/user/FOLDER/project/build/bin/
///Users/user/FOLDER/project/build/bin/resources/

//xcode
///Users/user/FOLDER/project/build/bin/Debug/
///Users/user/FOLDER/project/build/bin/Debug/resources/

//   clion
///ad053ed7/ad053ed7/Debug/bin/
///ad053ed7/ad053ed7/Debug/bin/resources/

As you can see I am getting three different outputs based on the same cmake
file using 3 ways of building.

is there a way to make these filenames consistent so that I when I try to
load some resources my code doesn't break?
-- 

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

[CMake] opening files relative to cmake build directory

2015-07-12 Thread Owen Alanzo Hogarth
I have a little project that's setup like this

project
main.c
build
resources
source
.../module1
.../module2
.../etc

main.c loads dynamic libs from under the source folder.

I am trying to open up a file using c fopen


I create a function to get the base resource path
which returns: /Users/me/projectresources/

I call get resource with test.txt
it'll return a string like this: /Users/me/project/resources/test.txt

but with my fopen command I get null error
Error while opening the file.
: No such file or directory

When I use the c command to find current working directory
it returns:
Current Directory = /Users/me/project/build/

how can I set up cmake to allow me to either use the full file path as in
Users/me/project/resources/[filename]

or a relative filename so that I can open my files?

Best,
Owen
-- 

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

[CMake] cmake linking errors in simple project

2015-07-06 Thread Owen Alanzo Hogarth
I created this simple project but I am having linking errors. Everything
builds correctly but when I try to add my lib to my main.c cmake complains
about linking errors.

Here's what the project looks like: http://pastebin.com/22bCsuiE

if i #include time_utils.h in my main.c I get this error:

Scanning dependencies of target launcher
[ 50%] Building C object CMakeFiles/launcher.dir/main.c.o
/Users/xx/project/main.c:2:10: fatal error: 'time_utils.h' file not found
#include time_utils.h

if I remove that line from the main.c it builds properly. I though adding
this line TARGET_LINK_LIBRARIES(auncher time_utils) to my cmakelists.txt it
would find the library but seems not. How can I make sure that the library
is found and properly linked?
-- 

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

[CMake] CMake fails on linking.

2015-07-02 Thread Owen Alanzo Hogarth
Hi guys

I wrote up this post on stackoverflow can I get some help sorting out why
this project isn't linking properly?

https://stackoverflow.com/questions/31186399/cmake-linking-errors

Best
-- 

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

[CMake] A little help please?

2015-06-25 Thread Owen Alanzo Hogarth
I wrote this post on SO and hoping to get some help sorting this out.
Please help with this build setup and linking.

http://stackoverflow.com/questions/31058688/cmake-not-properly-linking-files-after-successful-build
-- 

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

[CMake] A little help with cmake and external libraries

2015-06-24 Thread Owen Alanzo Hogarth
Hi ladies and gentlemen

I've just started using cmake a week or so ago but I am having some
difficulties getting cmake to find external libraries. I am not new to
programming just new to cmake.

I am making a very simple project with a structure like this
project
...cmakelists.txt
project/source
...cmakelists.txt
...main.c
project/source/core
cmakelists.txt
...source1.h
...source1.c
project/source/core/module1
project/source/core/module2
project/source/core/moduleN

the main.c will include source1.h, source1.h will include headers from the
sub modules as i build them out. The submodule1.h includes external
libraries.

This is what my main cmakelists looks like
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(bluengine)

SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 1)
SET(VERSION_PATCH 0)

SET(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

MESSAGE(Binary tree path ${PROJECT_SOURCE_DIR})
MESSAGE(Version ${VERSION})

ADD_SUBDIRECTORY(source)


the source cmake project looks like this:
PROJECT(launcher)

SET(SRC_FILES main.c)

ADD_EXECUTABLE(launcher, ${SRC_FILES})

ADD_SUBDIRECTORY(source)

This project starts to build but fails because of the import that's
included in main.c

I am on a mac and I know where the files are located, the headers are
located at /Library/Frameworks/SDL2.framework/Headers

but I am unsure how to set this project to go there and find the files.
I've read a few tutorials but they don't quite explain this in a way that I
can follow. Hoping someone on this mailing list can help me figure this out.

Best,
Owen
-- 

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