Re: [CMake] ExternalProject_Add

2017-01-08 Thread Hendrik Sattler
One possibility is the often mentioned superbuild, another is not using 
find_library() but setting the variables with the library file paths manually 
(that's static info anyway).


Am 8. Januar 2017 22:49:52 MEZ schrieb Saad Khattak :
>Hello,
>
>I have an external project glfw that I added to my project like this:
>
>==
>include(ExternalProject)
>ExternalProject_Add(glfw
>  GIT_REPOSITORY "https://github.com/glfw/glfw.git;
>  GIT_TAG "master"
>
>  SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw"
>  CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF
>-DGLFW_BUILD_EXAMPLES=OFF
>-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/install/glfw/
>-DCMAKE_DEBUG_POSTFIX=_d
>
>  TEST_COMMAND ""
>  )
>set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/")
>set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/")
>==
>
>Then I include it in my project like so:
>
>==
>find_library(GLFW_LIB_D  glfw3_d ${GLFW_LIBRARY_DIR})
>find_library(GLFW_LIBglfw3   ${GLFW_LIBRARY_DIR})
>
>include_directories(${GLFW_INCLUDE_DIR})
>
>add_executable(vk_test
>  src/vulkan_test.cpp
>  )
>target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized
>${GLFW_LIB})
>add_dependencies(vk_test glfw)
>==
>
>As you can see, I depend on the libraries compiled by the external
>project
>glfw. Unfortunately, when I first configure the project, CMake
>complains
>that it cannot find the libraries specified by ${GLFW_LIB_D} and
>${GLFW_LIB} variables.
>
>Of course, this is because CMake did not begin cloning, configuring and
>building the glfw project. That only happens AFTER my project has been
>configured and starts building. This becomes a chicken and the egg
>problem.
>
>Currently, my solution is to add dummy .lib files so that I can at
>least
>configure and generate my project. My question is, am I approaching
>this
>problem in the wrong way? If yes, what is the correct way to add a
>dependency to an external project and have it clone/configure/build
>BEFORE
>the "find_library" call?

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.
-- 

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-commits] CMake branch, master, updated. v3.7.1-928-g976574b

2017-01-08 Thread Kitware Robot
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
   via  976574b01009e11326c7894edf35a4f315b216d4 (commit)
  from  9cad0ec691f3d019a8737c4a6bb61c11573e6062 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=976574b01009e11326c7894edf35a4f315b216d4
commit 976574b01009e11326c7894edf35a4f315b216d4
Author: Kitware Robot <kwro...@kitware.com>
AuthorDate: Mon Jan 9 00:01:04 2017 -0500
Commit: Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Jan 9 00:01:04 2017 -0500

CMake Nightly Date Stamp

diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index d6394db..6b0bfe4 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 7)
-set(CMake_VERSION_PATCH 20170108)
+set(CMake_VERSION_PATCH 20170109)
 #set(CMake_VERSION_RC 1)

---

Summary of changes:
 Source/CMakeVersion.cmake |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


hooks/post-receive
-- 
CMake
___
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits


Re: [CMake] ExternalProject_Add

2017-01-08 Thread Nicholas Braden
The way to solve this is to use a superbuild project layout - you use
ExternalProject_Add to build your dependencies AND your own project, using
the DEPENDS option to control build order. Thus by the time it gets around
to configuring your project, the dependencies have already been built and
installed fully.

On Sun, Jan 8, 2017 at 3:49 PM, Saad Khattak  wrote:

> Hello,
>
> I have an external project glfw that I added to my project like this:
>
> ==
> include(ExternalProject)
> ExternalProject_Add(glfw
>   GIT_REPOSITORY "https://github.com/glfw/glfw.git;
>   GIT_TAG "master"
>
>   SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw"
>   CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF
> -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=${
> CMAKE_SOURCE_DIR}/install/glfw/ -DCMAKE_DEBUG_POSTFIX=_d
>
>   TEST_COMMAND ""
>   )
> set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/")
> set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/")
> ==
>
> Then I include it in my project like so:
>
> ==
> find_library(GLFW_LIB_D  glfw3_d ${GLFW_LIBRARY_DIR})
> find_library(GLFW_LIBglfw3   ${GLFW_LIBRARY_DIR})
>
> include_directories(${GLFW_INCLUDE_DIR})
>
> add_executable(vk_test
>   src/vulkan_test.cpp
>   )
> target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized ${GLFW_LIB})
> add_dependencies(vk_test glfw)
> ==
>
> As you can see, I depend on the libraries compiled by the external project
> glfw. Unfortunately, when I first configure the project, CMake complains
> that it cannot find the libraries specified by ${GLFW_LIB_D} and
> ${GLFW_LIB} variables.
>
> Of course, this is because CMake did not begin cloning, configuring and
> building the glfw project. That only happens AFTER my project has been
> configured and starts building. This becomes a chicken and the egg problem.
>
> Currently, my solution is to add dummy .lib files so that I can at least
> configure and generate my project. My question is, am I approaching this
> problem in the wrong way? If yes, what is the correct way to add a
> dependency to an external project and have it clone/configure/build BEFORE
> the "find_library" call?
>
>
> --
>
> 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] ExternalProject_Add

2017-01-08 Thread Saad Khattak
Hello,

I have an external project glfw that I added to my project like this:

==
include(ExternalProject)
ExternalProject_Add(glfw
  GIT_REPOSITORY "https://github.com/glfw/glfw.git;
  GIT_TAG "master"

  SOURCE_DIR "${CMAKE_SOURCE_DIR}/dep/glfw"
  CMAKE_ARGS -DGLFW_BUILD_DOCS=OFF -DGLFW_BUILD_TESTS=OFF
-DGLFW_BUILD_EXAMPLES=OFF
-DCMAKE_INSTALL_PREFIX=${CMAKE_SOURCE_DIR}/install/glfw/
-DCMAKE_DEBUG_POSTFIX=_d

  TEST_COMMAND ""
  )
set(GLFW_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/install/glfw/include/")
set(GLFW_LIBRARY_DIR "${CMAKE_SOURCE_DIR}/install/glfw/lib/")
==

Then I include it in my project like so:

==
find_library(GLFW_LIB_D  glfw3_d ${GLFW_LIBRARY_DIR})
find_library(GLFW_LIBglfw3   ${GLFW_LIBRARY_DIR})

include_directories(${GLFW_INCLUDE_DIR})

add_executable(vk_test
  src/vulkan_test.cpp
  )
target_link_libraries(vk_test debug ${GLFW_LIB_D} optimized ${GLFW_LIB})
add_dependencies(vk_test glfw)
==

As you can see, I depend on the libraries compiled by the external project
glfw. Unfortunately, when I first configure the project, CMake complains
that it cannot find the libraries specified by ${GLFW_LIB_D} and
${GLFW_LIB} variables.

Of course, this is because CMake did not begin cloning, configuring and
building the glfw project. That only happens AFTER my project has been
configured and starts building. This becomes a chicken and the egg problem.

Currently, my solution is to add dummy .lib files so that I can at least
configure and generate my project. My question is, am I approaching this
problem in the wrong way? If yes, what is the correct way to add a
dependency to an external project and have it clone/configure/build BEFORE
the "find_library" call?
-- 

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 Vulkan on 32 bit builds

2017-01-08 Thread Andreas Naumann

Hello,
Am 08.01.2017 um 07:22 schrieb Saad Khattak:

Hello,

When I run "find_package(VULKAN)" in a CMakeLists for a Visual Studio 
2015 32-bit project, the ${Vulkan_LIBRARY} and ${Vulkan_LIBRARIES} 
variables both point to the "Bin" folder for the Vulkan installation 
instead of the "Bin32" folder.


I looked at the FindVulkan.cmake module and even put MESSAGE(STATUS 
...) on the "elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)" to see if I made a 
mistake setting up. The message does indeed print confirming that my 
pointer size is 4 and thus the current toolchain selected is 32 bit.


What's perplexing is that when I do a MESSAGE(STATUS 
${Vulkan_LIBRARY}) the path is:



D:/VulkanSDK/1.0.37.0/Bin/vulkan-1.lib 


instead of


D:/VulkanSDK/1.0.37.0/Bin32/vulkan-1.lib 




It makes no sense. Line 47 of FindVulkan.cmake has Bin32. Why is CMake 
ignoring 32?


You should think the other way around: Why should cmake look in a 
special directory, when it finds a library with an appropriate name 
before this one?
This decision should be in the corresponding FindVulkan.cmake, i.e. the 
corresponding find_library call should be constrained to 
${VULKAN_DIR}/Bin32 in the 32bit case.





Regards,
Andreas
--

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] target_link_libraries is using relative path of library

2017-01-08 Thread Andreas Naumann

Hello,

on Linux cmake treats system directorys specially, i.e. those libraries 
are linked without any path.
Furthermore there are environment variables, whose content is added to 
the set of system directories.
I do not work on Windows, but your problem looks like a smiliar problem. 
Does some of the environment variables (except path) contain your 
directory?


Hope that helps,
Andreas

Am 08.01.2017 um 04:01 schrieb Saad Khattak:

Hello,

This is a very strange behavior I am encountering. I am using CMake 
3.7.1 with Visual Studio 2015. I have the following as part of a 
CMakeLists file:


find_library(glfw_LIB_D  glfw3_d ${glfw_LIBRARIES})
find_library(glfw_LIBglfw3   ${glfw_LIBRARIES})

When I do "message(STATUS ${glfw_LIB_D})" I get the full absolute 
path. However, when I add an executable that depends on the library:


add_executable(vk_test  src/vulkan_test.cpp  )
target_link_libraries(vk_test ${glfw_LIB_D})

CMake puts the relative path when I look at my project's project 
properties:


..\install\glfw\lib\glfw_d.lib

I also tried the following:

target_link_libraries(vk_test 
"${CMAKE_SOURCE_DIR}/install/glfw/lib/glfw_d.lib")


And it's still a relative path. Because of this issue, my project will 
not compile as Visual Studio is looking for the library in the 
incorrect folder.


I even set the following, thinking that somehow relative paths got set:

set(${CMAKE_USE_RELATIVE_PATHS} FALSE FORCE)

I still got the same relative path. What is 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] PROJECT( LANGUAGES ) and m4

2017-01-08 Thread Brad Bell
Using a custom_command (not custom_target) and a looping over the output 
file names, I was able to get cmake to properly track the m4 output 
files and create them when necessary; see

https://cmake.org/pipermail/cmake/2009-June/029909.html
This seems to me like a good solution.

On 01/06/2017 05:37 AM, Brad Bell wrote:

If one looks at the documentation
https://cmake.org/cmake/help/v3.0/command/project.html
one sees
project( [LANGUAGES] [...])
and the following text: 'By default C and CXX are enabled if no 
language options are given.'


It there a list of available languages ?

I have a project that has m4 input files. A single m4 input file can 
be used to generate output in Perl, Octave, Python, or C++ language. 
Can CMake handle this type of dependency, or would I have to use 
custom targets in this case ?





--

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