Re: [CMake] Finding internal libraries

2015-07-14 Thread Ruslan Baratov via CMake
John LaGrone wrote
> cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
> project(ex1)
> find_package(foo REQUIRED)
> add_executable(ex1.x ex1.c)
> target_link_libraries(ex1.x foo)

Just check that library exists already:

if(NOT TARGET foo)
  find_package(foo REQUIRED)
endif()



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/Finding-internal-libraries-tp7591003p7591056.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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] Using ExternalProject_Add when CMakeFiles.txt is not in the root directory.

2015-07-14 Thread Klaim - Joël Lamotte
I am attempting to use ExternalDependencies_Add with the last Protobuf
version (v3.0.0) which is in alpha3 (I'm using the master branch
actually)[1].
If you don't already know: contrary to previous Protobuf version, v3.x
provides
cmake scripts (and also makes CMake's FindProtobuf module unusuable if you
build Protobuf using CMake BTW).

I am having trouble figuring out how to ExternalProject_add work in this
case:
the CMakeFiles.txt is not in the root directory of Protobuf sources, it is
in ./cmake/ [2]
So at build time, after download, I obviously get:

>CUSTOMBUILD : CMake error : The source directory
"blahblah/install_protobuf" does not appear to contain CMakeLists.txt.

I tried several approaches using this as a base:

ExternalProject_Add( install_protobuf
PREFIX ${NETRUSH_DEPENDENCIES_DIR}/protobuf
GIT_REPOSITORY https://github.com/google/protobuf.git
GIT_TAG master

CMAKE_CACHE_ARGS
-DBUILD_TESTING:bool=FALSE
)


I tried setting SOURCE_DIR but failed to make it work mainly because I'm
not sure what value to set exactly, and

   SOURCE_DIR cmake

Does not seem to work.

I was wondering if there is some args I could pass to CMake using CMAKE_ARGS
but from the cmake[3] page in the doc I don't see anything that match
exactly, or
I might be misunderstanding something.

I found this recommandation from Miklos Espak from 8th February 2015:
"Specify a patch command that creates a toplevel cmake list with one
'add_subdirectory(A)'  line."

It seems to work, but it also means that the repository is modified, which
is something
I want to avoid. Also it's really a hack for passing the right working
directory to cmake.

Is there a simpler way to do it that I missed?

Thanks for your time.

Joël Lamotte


[1] https://github.com/google/protobuf
[2] https://github.com/google/protobuf/tree/master/cmake
[3] http://www.cmake.org/cmake/help/v3.3/manual/cmake.1.html#manual:cmake(1)
-- 

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] Problems wth Linux tar.gz packages on cmake.org

2015-07-14 Thread Stephen Sorley
For some reason, all the tar.gz packages on cmake.org are being downloaded
by google chrome as unzipped tar's (though the .tar.gz extension is
preserved).  I only see this behavior with chrome and cmake.org.  If I use
firefox, or if I download a tar.gz from somewhere else (the CMake github
"releases" page, for example), I do not observe this problem.

Thanks,
Stephen
-- 

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 own header files to a source code

2015-07-14 Thread Micha Hergarden
Hello,

You don't seem to tell cmake what executable you want and what sources
it is made up of. Take a look at the 'add_executable' and 'add_library'
commands. To create an executable from the sources, you may want to do
something like: add_executable(test01 test01.cc)
And for the library: add_library(trace libtrace.h libtrace.cc)

Add these statements between the 'find_package' and
'target_link_libraries' statements. If you then run cmake, two actual
build targets get generated which you can see with 'make help' if you
are using make.

Regards,
Micha

On 07/14/2015 01:51 PM, Peleg Bar-Sapir wrote:
> Hello,
>
> I'm trying to configure my own library (called "libtrace") to a test
> file I made.
>
> My source library contains the following files:
> libtrace.h -- Header file for the libtrace library.
> libtrace.cc -- Source file for the libtrace library.
> test01.cc -- A test file that uses libtrace.
> CMakeLists.txt -- CMake's config file.
>
> I also have a MySQL connector linked to my project (in the manner
> Daniel Schepler had helped me with back in late April) - so
> CMakeLists.txt looks like this:
> ...
> cmake_minimum_required(VERSION 2.8)
> project( Test )
>
> set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
> "${CMAKE_SOURCE_DIR}/cmake/Modules/")
>
> find_package( MySQL REQUIRED )
> target_link_libraries( Test ${MYSQL_LIBRARY} )
> include_directories(${MYSQL_INCLUDE_DIR})
> ...
>
> ...I cannot seem to connect my own library with nay success (I
> followed the tutorial from here: http://www.cmake.org/cmake-tutorial/
> ). It keeps giving me errors.
>
> Any help with ordering the CMakeLists.txt file would be greatly
> appreciated.
>
>
> Thanks,
>
> Peleg Bar Sapir
>
>



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

Re: [CMake] Patch for Sphinx warning message

2015-07-14 Thread Brad King
On 07/14/2015 12:57 AM, Andrew Maclean wrote:
> This patch fixes this warning when building CMake from the master:
> "WARNING: 'default' html theme has been renamed to 'classic'.

Applied with slight tweaks:

 Utilities/Sphinx: Use 'classic' theme for Sphinx >= 1.3
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e59a7d7e

Thanks,
-Brad
-- 

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] Is there any way to set a build-type specific install path for multiconfig tools?

2015-07-14 Thread David Cole via CMake
Most of the variables that have a per-config variation on the name end
with "_" ( see the page documenting CMake variables, and
search it for "config" to get a sense of which variables these are...
http://www.cmake.org/cmake/help/v3.3/manual/cmake-variables.7.html )
-- s, if you do prepare any patches for consideration, I would say
use "CMAKE_INSTALL_PREFIX_" as the names of the alternate
variables.

I don't know what the consensus opinion will be, but I think
CMAKE_INSTALL_PREFIX is already difficult to understand fully as-is,
and I would hesitate to add per-config complexity to it. I am certain
there are others with different opinions on the matter, though. We'll
see if anybody else chimes in.


D




On Tue, Jul 14, 2015 at 7:52 AM, Clifford Yapp  wrote:
> On Mon, Jul 13, 2015 at 1:45 PM, David Cole  wrote:
>
>> The other "no need to modify CMake" way to achieve this (although it
>> may be considered "too ugly" or non-ideal by some) would be to force
>> the use of a single configuration per build tree, and use the proper
>> value for CMAKE_INSTALL_PREFIX in each build tree.
>>
>> Your developers may not like that, but it would sure make the problem
>> at hand disappear.
>
> It would, but I think I would agree that's a fairly ugly solution - at
> least, it violates assumptions a dev might reasonably make in the
> multi-config workflow.  What I have in place now does the job and
> works (or at least, it did the last time I tried it) so I can stick
> with it if need be, but I figured it was worth raising the question to
> see if there either already existed a cleaner way or there was a way
> to add a "clean" way that would be acceptable to the devs.
>
>> The other thing to consider is that the file cmake_install.cmake,
>> generated at the top of your build tree contains code like the
>> following:
>>
>> # Set the install prefix
>> if(NOT DEFINED CMAKE_INSTALL_PREFIX)
>>   set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/Tutorial")
>> endif()
>>
>> In the end, installing your project is ultimately a call of some sort
>> to "cmake -P cmake_install.cmake" -- you could simply install your
>> project with a custom call to that script which passes in the proper
>> value for CMAKE_INSTALL_PREFIX using -D... The above generated code
>> allows you to override it by passing it in when the script is called.
>>
>> The Visual Studio command for the INSTALL project looks like this:
>>
>> "C:\Program Files (x86)\CMake\bin\cmake.exe"
>> -DBUILD_TYPE=$(Configuration) -P cmake_install.cmake
>>
>> You could easily write a custom target / custom command that is an
>> alternate "configuration-prefixed" install as:
>>
>> "C:\Program Files (x86)\CMake\bin\cmake.exe"
>> -DBUILD_TYPE=$(Configuration)
>> -DCMAKE_INSTALL_PREFIX=config-specific-value-here -P
>> cmake_install.cmake
>
> Can that bit of code be controlled from the CMakeLists.txt file, or
> would I need to manually overwrite it in some fashion after it is
> generated?
>
> If a patch were prepared to use variables like
> CMAKE_DEBUG_INSTALL_PREFIX, would the devs consider it?  That still
> feels to me like it's probably the "right" solution given how CMake
> handles this for things like C flags, unless it causes too many other
> problems...
>
> Thanks,
> CY
-- 

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] Exporting/Publishing settings (e. g. include directories) from subdirectories

2015-07-14 Thread Rainer Poisel
Hi list,

I have a project that consists of several subdirectories. For example:

project-dir
+- component1
|  +- src
|  +- include-dir1
|  +- include-dir2
+- component2

Let's say I want "component2" to add "include-dir1" and "include-dir2"
from "component1" as include directories without "component2" knowing
that these two directories exist.

Therefore my question: Is there a way to import project
settings/properties which have been exported from other
subdirectories? And is cmake intended to be used like that?

I don't know whether I use the correct terms here but I hope that the
idea is clear.

Regards,
  Rainer
-- 

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] Why does changing -G not change generators?

2015-07-14 Thread David Cole via CMake
It's just something you can't change without wiping the build tree
entirely. It should probably actually produce an error or warning of
some sort to avoid confusion such as this...

D


On Tue, Jul 14, 2015 at 11:01 AM, Paul Smith  wrote:
> We have a situation where people are sometimes wanting to switch between
> different generators: from Xcode to Unix Makefiles, or from Visual
> Studio 2010 to Visual Studio 2012, etc.
>
> If they have an already-configured workspace then run "cmake -G" with a
> different generator, it appears to be a no-op: no error is generated but
> no changes are made and the previous generator is still used.
>
> This doesn't seem right to me... shouldn't giving a new generator type
> on the command line change the output for the new generator?  I'm using
> CMake 3.1.0... maybe this has changed since?
>
> Cheers!
>
> --
>
> 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] Why does changing -G not change generators?

2015-07-14 Thread Paul Smith
We have a situation where people are sometimes wanting to switch between
different generators: from Xcode to Unix Makefiles, or from Visual
Studio 2010 to Visual Studio 2012, etc.

If they have an already-configured workspace then run "cmake -G" with a
different generator, it appears to be a no-op: no error is generated but
no changes are made and the previous generator is still used.

This doesn't seem right to me... shouldn't giving a new generator type
on the command line change the output for the new generator?  I'm using
CMake 3.1.0... maybe this has changed since?

Cheers!

-- 

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] Can't find wxWidgets

2015-07-14 Thread Bob Bachman

I just wanted to close out this thread. The problem turned out to be DOS 
line endings in the wx-config file. The following line in the wxWidgets-
3.0.2/buildgtk/lib/wx/config directory fixed the problem.

dos2unix inplace-gtk2-unicode-3.0 inplace-gtk2-unicode-3.0

Thanks for your help.
Bob


-- 

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 own header files to a source code

2015-07-14 Thread Peleg Bar-Sapir
Hello,

I'm trying to configure my own library (called "libtrace") to a test file I
made.

My source library contains the following files:
libtrace.h -- Header file for the libtrace library.
libtrace.cc -- Source file for the libtrace library.
test01.cc -- A test file that uses libtrace.
CMakeLists.txt -- CMake's config file.

I also have a MySQL connector linked to my project (in the manner Daniel
Schepler had helped me with back in late April) - so CMakeLists.txt looks
like this:
...
cmake_minimum_required(VERSION 2.8)
project( Test )

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")

find_package( MySQL REQUIRED )
target_link_libraries( Test ${MYSQL_LIBRARY} )
include_directories(${MYSQL_INCLUDE_DIR})
...

...I cannot seem to connect my own library with nay success (I followed the
tutorial from here: http://www.cmake.org/cmake-tutorial/ ). It keeps giving
me errors.

Any help with ordering the CMakeLists.txt file would be greatly appreciated.


Thanks,

Peleg Bar Sapir
-- 

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] Code Coverage of CMake Scripts

2015-07-14 Thread Jörg Kreuzberger
Hi!

i just want to get coverage information from the configure step itself
to find uncovered cmake makros and scripts.

The --trace option seems to be the way to do it.
is there any tool/script available to get these information in a good report?

BEST solution would be something like lgov or govr :-)

Thanks for any suggestions :-)

Joerg

-- 

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