Re: [CMake] Error in running tests

2013-04-12 Thread Petr Kmoch
1. Can you post tests/CMakeLists.txt (or at least the parts relevant to
creating test_rev)?

2. Does it work if you use the enhanced signature of add_test? I mean
'add_test(NAME Test COMMAND test_rev)'

Petr


On Fri, Apr 12, 2013 at 1:18 PM, Lloyd  wrote:

> Yes I built the test and it is in
>
> E:\CMakeDemo\BuildDir\tests\Debug\test_rev.exe
>
> I don't know the right way to locate this test executable for cmake
>
> Thanks,
>   Lloyd
>
>
>
> On Fri, Apr 12, 2013 at 4:42 PM, Petr Kmoch  wrote:
>
>> Hi Lloyd.
>>
>> Do you actually have a target (executable) named "test_rev"? And have you
>> built it before running RUN_TESTS? RUN_TEST (or its Makefile equivalent
>> 'make test') doesn't automatically build the test executables before
>> running them.
>>
>> Petr
>>
>>
>> On Fri, Apr 12, 2013 at 1:08 PM, Lloyd  wrote:
>>
>>> Hi,
>>>
>>> I was successful in creating and compiling a simple project C++/Visual
>>> studio using cmake. I have also included one unit test project. All these
>>> projects builds successfully. The test project source and main project
>>> source resides in the root directory of the project. When I try to run
>>> "RUN_TESTS" it gives me an error
>>>
>>> Test project E:/CMakeDemo/BuildDir
>>> 1>  Start 1: Test
>>> 1>  Could not find executable test_rev
>>> 1>  Looked in the following places:
>>> 1>  Unable to find executable: test_rev
>>> 1>  test_rev
>>> 1>  test_rev.exe
>>> 1>  Debug/test_rev
>>> 1>  Debug/test_rev.exe
>>> 1>  Debug/test_rev
>>> 1>  Debug/test_rev.exe
>>> 1>  1/1 Test #1: Test .***Not Run   0.00 sec
>>>
>>> I have added the tests in my main cmake file as shown below
>>>
>>> #Root cmake file
>>> cmake_minimum_required (VERSION 2.6)
>>> PROJECT (Tutorial)
>>>
>>> ADD_SUBDIRECTORY(src/lib/reverse)
>>> ADD_SUBDIRECTORY(src)
>>> #SUBDIRS(src/lib/reverse src)
>>>
>>> 
>>> SET (DO_TEST false CACHE BOOL "Enable Testing?")
>>> if(DO_TEST)
>>> MESSAGE (STATUS "Testing is enabled")
>>> ENABLE_TESTING()
>>> ADD_SUBDIRECTORY(tests)
>>>
>>>
>>> ADD_TEST(Test test_rev)
>>>
>>>
>>> endif(DO_TEST)
>>> #
>>>
>>>
>>> What am i missing here?
>>>
>>> Thanks a lot,
>>>   Lloyd
>>>
>>>
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
>>>
>>
>>
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Error in running tests

2013-04-14 Thread Petr Kmoch
The errors VS spews out aren't really useful. However, if you go to
${CMAKE_BINARY_DIR}/Testing/Temporary, there are log files. LastTest.log
should tell you a bit more.

Can you also try/report on my second question? (2. Does it work if you use
the enhanced signature of add_test? I mean 'add_test(NAME Test COMMAND
test_rev)')

Petr


On Mon, Apr 15, 2013 at 6:43 AM, Lloyd  wrote:

>
> On Fri, Apr 12, 2013 at 5:00 PM, Lloyd  wrote:
>
>> of course... This is the source of my test cmake file
>>
>> #Cmake file of Tests
>> cmake_minimum_required (VERSION 2.6)
>>
>> SET(TST_SRC test_rev.cpp test_runner.cpp)
>>
>> FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
>>
>> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
>> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)
>> ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
>> ADD_EXECUTABLE(test_rev ${TST_SRC})
>> TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})
>> TARGET_LINK_LIBRARIES(test_rev Reverse)
>>
>
>
> As a temporary solution to this I have copied the test executable and its
> dependent dlls to the root folder of the build directory. When I run
> "RUN_TETS" project in Visual Studio, it throws me some other error like
>
>
> -- Build started: Project: RUN_TESTS, Configuration: Debug Win32 --
>   Test project E:/CMakeDemo/BuildDir
>   Start 1: Test
>   1/1 Test #1: Test .***Failed0.16 sec
>
>   0% tests passed, 1 tests failed out of 1
>
>   Total Test time (real) =   2.42 sec
>
>   The following tests FAILED:
> 1 - Test (Failed)
>   Errors while running CTest
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: The command "setlocal
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: "C:\Program Files\CMake 2.8\bin\ctest.exe"
> --force-new-ctest-process -C Debug
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: if %errorlevel% neq 0 goto :cmEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmErrorLevel
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: exit /b %1
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :cmDone
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: if %errorlevel% neq 0 goto :VCEnd
> C:\Program
> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
> MSB3073: :VCEnd" exited with code 8.
>  Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==
>
> I cannot interpret these errors, can you please give some hint?
>
> Thanks,
>   Lloyd
>
>
>
>
>>
>>
>> On Fri, Apr 12, 2013 at 4:55 PM, Petr Kmoch  wrote:
>>
>>> 1. Can you post tests/CMakeLists.txt (or at least the parts relevant to
>>> creating test_rev)?
>>>
>>> 2. Does it work if you use the enhanced signature of add_test? I mean
>>> 'add_test(NAME Test COMMAND test_rev)'
>>>
>>> Petr
>>>
>>>
>>> On Fri, Apr 12, 2013 at 1:18 PM, Lloyd  wrote:
>>>
>>>> Yes I built the test and it is in
>>>>
>>>> E:\CMakeDemo\BuildDir\tests\Debug\test_rev.exe
>>>>
>>>> I don't know the right way to locate this test executable for cmake
>>>>
>>>> Thanks,
>>>>   Lloyd
>>>>
>>>>
>>>>
>>>> On Fri, Apr 12, 2013 at 4:42 PM, Petr Kmoch wrote:
>>>>
>>>>> Hi Lloyd.
>>>>>
>>>>> Do you actually have a target (executable) named "test_rev"? And have
>>>>> you built it before running RUN_TESTS? RUN_TEST (or its Makefile 
>>>>> equivalent
>>>>> 'make test') doesn't automatically build the test executables before
>>>>> running them.
>>>>>
>>>>> Petr
>>>>>
>>>>>
>>>>> On Fri, Apr 12, 2013 at 1:08 PM, Lloyd  wrote:
>>>>>
>>>>>> Hi,
>>>>>>

Re: [CMake] Error in running tests

2013-04-15 Thread Petr Kmoch
It's good the second signature works; I believe there's hardly ever use for
using the first one, anyway.

As for the DLLs, would it help if you set the WORKING_DIRECTORY parameter
in add_test(), and/or set the PATH env. variable using the test's property
ENVIRONMENT?

On Unix systems, the path issues should be handled by RPATH/RUNPATH.

Petr


On Mon, Apr 15, 2013 at 10:58 AM, Lloyd  wrote:

>
>
>
> On Mon, Apr 15, 2013 at 12:10 PM, Petr Kmoch  wrote:
>
>> The errors VS spews out aren't really useful. However, if you go to
>> ${CMAKE_BINARY_DIR}/Testing/Temporary, there are log files. LastTest.log
>> should tell you a bit more.
>>
>> Can you also try/report on my second question? (2. Does it work if you
>> use the enhanced signature of add_test? I mean 'add_test(NAME Test COMMAND
>> test_rev)')
>>
>>
> Sorry, I missed the important point you suggested try. Yes, When I tried
> the 'add_test(NAME Test COMMAND test_rev)') format, it works.
>
> To make it work I had to manually copy the boost test library (dll) as
> well as the my libraries "dll" to the root of build folder. What is the
> approach used by "professional" developers? I tried looking at the cmake
> file of VTK, but it contains only "MAKE_DIRECTORY and ADD_SUBDIRECTORY"
> commands!
>
> Thanks
>   Lloyd
>
>
>
>
>
>> Petr
>>
>>
>> On Mon, Apr 15, 2013 at 6:43 AM, Lloyd  wrote:
>>
>>>
>>> On Fri, Apr 12, 2013 at 5:00 PM, Lloyd  wrote:
>>>
>>>> of course... This is the source of my test cmake file
>>>>
>>>> #Cmake file of Tests
>>>> cmake_minimum_required (VERSION 2.6)
>>>>
>>>> SET(TST_SRC test_rev.cpp test_runner.cpp)
>>>>
>>>> FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
>>>>
>>>> INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
>>>> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}../../src/lib/reverse)
>>>> ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
>>>> ADD_EXECUTABLE(test_rev ${TST_SRC})
>>>> TARGET_LINK_LIBRARIES(test_rev ${Boost_LIBRARIES})
>>>> TARGET_LINK_LIBRARIES(test_rev Reverse)
>>>>
>>>
>>>
>>> As a temporary solution to this I have copied the test executable and
>>> its dependent dlls to the root folder of the build directory. When I run
>>> "RUN_TETS" project in Visual Studio, it throws me some other error like
>>>
>>>
>>> -- Build started: Project: RUN_TESTS, Configuration: Debug Win32
>>> --
>>>   Test project E:/CMakeDemo/BuildDir
>>>   Start 1: Test
>>>   1/1 Test #1: Test .***Failed0.16 sec
>>>
>>>   0% tests passed, 1 tests failed out of 1
>>>
>>>   Total Test time (real) =   2.42 sec
>>>
>>>   The following tests FAILED:
>>> 1 - Test (Failed)
>>>   Errors while running CTest
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: The command "setlocal
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: "C:\Program Files\CMake 2.8\bin\ctest.exe"
>>> --force-new-ctest-process -C Debug
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: if %errorlevel% neq 0 goto :cmEnd
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: :cmEnd
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: :cmErrorLevel
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: exit /b %1
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: :cmDone
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: if %errorlevel% neq 0 goto :VCEnd
>>> C:\Program
>>> Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error
>>> MSB3073: :VCEnd" exited with code 8.
>>>  Build: 0 succeeded

Re: [CMake] Superbuild subprojects and find_package()

2013-04-17 Thread Petr Kmoch
Hi John,

the primary tool for superbuilds in CMake's arsenal is ExternalProject_Add
from module ExternalProject. I don't have much experience with it, but you
can read its docs to see if it could help you.

Petr


On Thu, Apr 18, 2013 at 5:38 AM, John Gallagher <
johnkgallagher+cm...@gmail.com> wrote:

> Hello all,
>
> Some Googling has led me to questions that have been asked that are
> similar to this one but I haven't seen a definitive answer. I'm trying to
> set up a CMake "superbuild" where there are dependencies between the
> subprojects, and some of the subprojects use find_package() to import
> targets from their dependencies (other subprojects, from the superbuild's
> point of view). For a stripped down example, suppose I have proj1 and
> proj2. proj1 can be built and installed on its own, and it writes out a
> Proj1Config.cmake file (with targets and such). proj2 uses
>
> find_package(Proj1 REQUIRED)
>
> to import those targets. So independent of a CMake superbuild, things work
> just fine if I configure, build, and install proj1, *then* configure,
> build, and install proj2. Is there a way to do this using a CMake
> superbuild? Some ideas (mostly gleaned from the aforementioned googling):
>
> 1. Use add_subdirectory() from the superproject. I think the REQUIRED on
> find_package() would fail though? In my case I can modify the subprojects,
> but I would like for them to continue to build correctly standalone (not
> inside the superbuild), as they really are separate projects. Is there a
> way to make add_subdirectory() work without exploding on find_package?
>
> 2. Don't use CMake for the "superbuild" - a shell script or plain Makefile
> could accomplish this pretty easily, but that seems a little hokey.
>
> 3. (This one is unclear.) Somehow build proj1 before configuring proj2,
> and point proj2 at proj1's build directory so it can find
> Proj1Config.cmake. This seems fragile at best (prefix, RPATH, etc issues).
>
> Appreciate any advice!
>
> John
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Problem with get_filename_component() and CMAKE_CXX_COMPILER when finding Qt4

2013-04-22 Thread Petr Kmoch
If you look at the trace, you'll see the following few lines before the
error:

C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindQt4.cmake(738):
set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES} )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindQt4.cmake(739):
set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS} )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindQt4.cmake(741):
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR} )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/FindQt4.cmake(743):
CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 QtCore/qglobal.h Q_WS_X11 )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckCXXSymbolExists.cmake(41):
_CHECK_SYMBOL_EXISTS(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx
Q_WS_X11 QtCore/qglobal.h Q_WS_X11 )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(46):  if(Q_WS_X11
MATCHES ^Q_WS_X11$ )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(47):
set(CMAKE_CONFIGURABLE_FILE_CONTENT /* */\n )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(48):
set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS} )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(49):
if(CMAKE_REQUIRED_LIBRARIES )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(54):  else()
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(55):
set(CHECK_SYMBOL_EXISTS_LIBS )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(57):
if(CMAKE_REQUIRED_INCLUDES )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(58):
set(CMAKE_SYMBOL_EXISTS_INCLUDES
-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES} )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(63):  foreach(FILE
QtCore/qglobal.h )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(64):
set(CMAKE_CONFIGURABLE_FILE_CONTENT
${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(67):
set(CMAKE_CONFIGURABLE_FILE_CONTENT ${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint
main(int argc, char** argv)\n{\n  (void)argv;\n#ifndef Q_WS_X11\n  return
((int*)(&Q_WS_X11))[argc];\n#else\n  (void)argc;\n  return 0;\n#endif\n}\n )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(70):
configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in
D:/Tmp/cmake/bld/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx @ONLY IMMEDIATE )
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(73):  message(STATUS
Looking for Q_WS_X11 )
-- Looking for Q_WS_X11
C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(74):
try_compile(Q_WS_X11 ${CMAKE_BINARY_DIR}
D:/Tmp/cmake/bld/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
${CHECK_SYMBOL_EXISTS_LIBS} ${CMAKE_SYMBOL_EXISTS_INCLUDES} OUTPUT_VARIABLE
OUTPUT )
CMake Error at C:/Program Files (x86)/CMake
2.8/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:37
(get_filename_component):
  get_filename_component called with incorrect number of arguments
Call Stack (most recent call first):
  CMakeLists.txt:2 (PROJECT)




On Mon, Apr 22, 2013 at 3:05 PM, Rolf Eike Beer  wrote:

> Am 22.04.2013 14:26, schrieb Petr Kmoch:
>
>  Hi all.
>>
>> I'm using CMake 2.8.10.2 to do a Visual Studio 2010 64-bit build, and I
>> encountered a weird problem with the CMake configure step failing, with
>> the
>> following output:
>>
>> CMake Error at C:/Program Files (x86)/CMake
>> 2.8/share/cmake-2.8/Modules/**CMakeCXXInformation.cmake:37
>> (get_filename_component):
>>   get_filename_component called with incorrect number of arguments
>> Call Stack (most recent call first):
>>   CMakeLists.txt:2 (PROJECT)
>>
>
> CMAKE_CXX_COMPILER is empty at that point.
>
>
>  I managed to pinpoint this to an issue with try_compile in FindQt4. I am
>> attaching a minimal test case as well as output of cmake --trace. The
>> CMakeList is just this:
>>
>
> I don't see a try_compile in FindQt4.
>
> Eike
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/**CMake_FAQ<http://www.cmake.org/Wiki/CMake_FAQ>
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.or

Re: [CMake] Excluding targets from a solution config in a Visual Studio build

2013-04-23 Thread Petr Kmoch
Hi Alessio.

There is a target property EXCLUDE_FROM_DEFAULT_BUILD. If you set this on a
target to true, the target will be removed from "Build Solution."

2.8.11 should introduce a per-config variant of this property,
EXCLUDE_FROM_DEFAULT_BUILD_.

Petr


On Mon, Apr 22, 2013 at 7:15 PM, Alessio wrote:

> Hi there
>
> Is there a way to tell the Visual Studio generators that a target should
> not be included in “whole solution” builds?
>
> With the following sequence A will be excluded from all solution
> configurations, but B will be included.
>
> add_custom_target(A)
>
> add_custom_target(B COMMAND echo This is target B)
>
> add_dependencies(A B)
>
> I’m actually trying to define a set of targets that do not get built
> automatically when one does a “solution build” in Visual Studio. I.e. I’d
> like to find a way to have B excluded as well.
>
> Is this possible at all?
>
> Thanks in advance! And thanks to the CMake folks for the great tool!
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Problem with get_filename_component() and CMAKE_CXX_COMPILER when finding Qt4

2013-04-29 Thread Petr Kmoch
Any idea on this? Or should I file a bug report?


On Mon, Apr 22, 2013 at 3:15 PM, Petr Kmoch  wrote:

> If you look at the trace, you'll see the following few lines before the
> error:
>
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/FindQt4.cmake(738):
> set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES} )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/FindQt4.cmake(739):
> set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS} )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/FindQt4.cmake(741):
> set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR} )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/FindQt4.cmake(743):
> CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 QtCore/qglobal.h Q_WS_X11 )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckCXXSymbolExists.cmake(41):
> _CHECK_SYMBOL_EXISTS(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.cxx
> Q_WS_X11 QtCore/qglobal.h Q_WS_X11 )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(46):  if(Q_WS_X11
> MATCHES ^Q_WS_X11$ )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(47):
> set(CMAKE_CONFIGURABLE_FILE_CONTENT /* */\n )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(48):
> set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS} )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(49):
> if(CMAKE_REQUIRED_LIBRARIES )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(54):  else()
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(55):
> set(CHECK_SYMBOL_EXISTS_LIBS )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(57):
> if(CMAKE_REQUIRED_INCLUDES )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(58):
> set(CMAKE_SYMBOL_EXISTS_INCLUDES
> -DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES} )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(63):  foreach(FILE
> QtCore/qglobal.h )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(64):
> set(CMAKE_CONFIGURABLE_FILE_CONTENT
> ${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(67):
> set(CMAKE_CONFIGURABLE_FILE_CONTENT ${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint
> main(int argc, char** argv)\n{\n  (void)argv;\n#ifndef Q_WS_X11\n  return
> ((int*)(&Q_WS_X11))[argc];\n#else\n  (void)argc;\n  return 0;\n#endif\n}\n )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(70):
> configure_file(${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in
> D:/Tmp/cmake/bld/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx @ONLY IMMEDIATE )
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(73):  message(STATUS
> Looking for Q_WS_X11 )
> -- Looking for Q_WS_X11
> C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CheckSymbolExists.cmake(74):
> try_compile(Q_WS_X11 ${CMAKE_BINARY_DIR}
> D:/Tmp/cmake/bld/CMakeFiles/CMakeTmp/CheckSymbolExists.cxx
> COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} CMAKE_FLAGS
> -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
> ${CHECK_SYMBOL_EXISTS_LIBS} ${CMAKE_SYMBOL_EXISTS_INCLUDES} OUTPUT_VARIABLE
> OUTPUT )
>
> CMake Error at C:/Program Files (x86)/CMake
> 2.8/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:37
> (get_filename_component):
>   get_filename_component called with incorrect number of arguments
> Call Stack (most recent call first):
>   CMakeLists.txt:2 (PROJECT)
>
>
>
>
> On Mon, Apr 22, 2013 at 3:05 PM, Rolf Eike Beer  wrote:
>
>> Am 22.04.2013 14:26, schrieb Petr Kmoch:
>>
>>  Hi all.
>>>
>>> I'm using CMake 2.8.10.2 to do a Visual Studio 2010 64-bit build, and I
>>> encountered a weird problem with the CMake configure step failing, with
>>> the
>>> following output:
>>>
>>> CMake Error at C:/Program Files (x86)/CMake
>>> 2.8/share/cmake-2.8/Modules/**CMakeCXXInformation.cmake:37
>>> (get_filename_component):
>>>   get_filename_component called with incorrect number of arguments
>>> Call Stack (most recent call first):
>>>   CMakeLists.txt:2 (PROJECT)
>>>
>>
>> CMAKE_CXX_COMPILER is empty at that point.
>>
>>
>>  I managed to pinpoint this to an issue with try_compile in FindQt4. I am
>>> attaching a minimal

Re: [CMake] Phony targets - FAQ?

2013-05-28 Thread Petr Kmoch
Hi Dan.

Note that the docs don't say that a custom target will "always be built,"
but that it's "always considered out of date." That's something else. It
means that it will always be built *if building it is considered*. So
'make' will never skip it as "up to date," but will not build it unless
told to do so (on the command line or through a dependency).

Petr


On Tue, May 28, 2013 at 7:33 PM, Dan Kegel  wrote:

> In projects that include a directory full of example programs that
> don't usually need to be built,
> it's convenient to have a phony target 'examples' that builds the examples.
>
> add_custom_target looks like it's the way to implement phony targets, but
> the
> doc confused me.  It said targets created with that are always built.  That
> made me think it was added as a dependency of all!
>
> The example CMakeLists.txt,
>
> add_executable(foo1 EXCLUDE_FROM_ALL foo1.c)
> add_custom_target(bar1 DEPENDS foo1 COMMAND echo hi)
>
> seems to do the Right Thing (it doesn't build foo1 or bar1 by default,
> but does build it if you do 'cmake; make bar1').
>
> Should this be in the FAQ under "How do I create a phony target"?
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Fwd: Problems setting CMAKE_CONFIGURATION_TYPES for Visual Studio

2013-05-29 Thread Petr Kmoch
Hi Janosch.

A solution to this problem which works for me is: if the configurations are
not those I want, set them correctly and abort the generation (with a help
message).

I put the following code into the CMakeList after the call to project():

if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES MATCHES
FullDebug)
  set(cfgs ${CMAKE_CONFIGURATION_TYPES})
  list(REMOVE_ITEM cfgs MinSizeRel)
  list(APPEND cfg FullDebug)
  set(CMAKE_CONFIGURATION_TYPES ${cfgs} CACHE STRING "List of supported
configurations." FORCE)
  message(FATAL_ERROR "List of configurations was reset, please re-run
CMake.")
endif()

Hope this helps.

Petr


On Wed, May 29, 2013 at 1:14 PM, gaga bla  wrote:

> Hello Eric,
> thanks for your reply, i tried this, but in my case it doesn't work. I
> made a function that first sets the configuration types (using your line of
> code) and then calls the project function. Using this function instead of
> the project function itself, still all configurations are beeing generated.
> I browsed through the cmake sources and modules, but i coudn't find the
> place that reintroduces those configurations.
> It looks like a bug to me, later on i will try to produce an example.
>
> Kind regards
> Janosch
>
>
> On Tue, May 28, 2013 at 10:01 PM, Eric Clark  wrote:
>
>>  Our projects limit the types to just Debug and Release. However, what I
>> found was that you had to set the variable before every call to project(…).
>> What we did was we created a module called BuildTypes.cmake and include it
>> first thing in every list file. The file has one line of code in it that
>> looks like this:
>>
>> ** **
>>
>> set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE)***
>> *
>>
>> ** **
>>
>> This does the trick for us. Hope this helps…
>>
>> ** **
>>
>> Eric
>>
>> ** **
>>
>> *From:* cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] *On
>> Behalf Of *gaga bla
>> *Sent:* Tuesday, May 28, 2013 12:55 PM
>> *To:* cmake@cmake.org
>> *Subject:* [CMake] Problems setting CMAKE_CONFIGURATION_TYPES for Visual
>> Studio
>>
>> ** **
>>
>> Hello, I have problems reducing available configuration types for a
>> Visual Studio project.
>>
>> No matter what I do, the project always contains all four configuration
>> types.
>>
>>  
>>
>> I have two files involved, I tried to strip everything that seemed to be
>> unimportant:
>>
>>  
>>
>> CmakeLists.txt (Main file):
>>
>> 
>>
>> include("... Helpers.cmake")
>>
>> configureMyProject("MyProject")
>>
>> message("Config types (outside): ${CMAKE_CONFIGURATION_TYPES}")
>>
>> 
>>
>>  
>>
>> Helpers.cmake:
>>
>> 
>>
>> if(__myhelpers)
>>
>> return()
>>
>> endif()
>>
>> set(__myhelpers YES)
>>
>>  
>>
>> function(configureMyProject MY_NAME )
>>
>>   set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
>> FORCE)
>>
>>   message("Config types (before): ${CMAKE_CONFIGURATION_TYPES}") 
>>
>>   project(${MY_NAME}) 
>>
>>   message("Config types (after): ${CMAKE_CONFIGURATION_TYPES}") 
>>
>>   set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
>> FORCE) 
>>
>>   message("Config types (after 2): ${CMAKE_CONFIGURATION_TYPES}")
>>
>>   ...
>>
>>   add_library(...)
>>
>>   ...
>>
>> endfunction()
>>
>> 
>>
>>  
>>
>> I then get the following output:
>>
>> 
>>
>> Config types (before): Debug;RelWithDebInfo
>>
>> Config types (after): Debug;Release;MinSizeRel;RelWithDebInfo
>>
>> Config types (after 2): Debug;RelWithDebInfo
>>
>> Config types (outside): Debug;RelWithDebInfo
>>
>> 
>>
>>  
>>
>> So it seems to me, that the call of the project-function resetted the
>> configuration types and created then the project accordingly.
>>
>> Is this a bug or am I doing something wrong? Does anyone know a
>> workaround?
>>
>>  
>>
>> Kind regards
>>
>> Janosch Scharlipp
>>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Fwd: Problems setting CMAKE_CONFIGURATION_TYPES for Visual Studio

2013-05-29 Thread Petr Kmoch
I haven't looked into CMake code deep enough, so I don't really know how it
works either. Maybe project() stores something into the cache which causes
it to not trample over the configuration list in the next run. Just
guessing.

Petr


On Wed, May 29, 2013 at 4:40 PM, gaga bla  wrote:

> Hello Petr,
> i don't understand how this solves the problem, but indeed it does!
>
> Still i have one small problem. To make regeneration of a clean project as
> easy as possible, i have a batch file, which first clears all generated
> data (including cmake cache), an then runs cmake. Since this fails now the
> first time, i have to run cmake twice in this batch file, but if other
> errors occour, i get output twice.
>
> Maybe if i could understand why your solution works, i could come up with
> one that works without running cmake once again?
>
> Thanks so far!
> Janosch
>
>
> On Wed, May 29, 2013 at 1:34 PM, Petr Kmoch  wrote:
>
>> Hi Janosch.
>>
>> A solution to this problem which works for me is: if the configurations
>> are not those I want, set them correctly and abort the generation (with a
>> help message).
>>
>> I put the following code into the CMakeList after the call to project():
>>
>> if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES MATCHES
>> FullDebug)
>>   set(cfgs ${CMAKE_CONFIGURATION_TYPES})
>>   list(REMOVE_ITEM cfgs MinSizeRel)
>>   list(APPEND cfg FullDebug)
>>   set(CMAKE_CONFIGURATION_TYPES ${cfgs} CACHE STRING "List of supported
>> configurations." FORCE)
>>   message(FATAL_ERROR "List of configurations was reset, please re-run
>> CMake.")
>> endif()
>>
>> Hope this helps.
>>
>> Petr
>>
>>
>> On Wed, May 29, 2013 at 1:14 PM, gaga bla  wrote:
>>
>>> Hello Eric,
>>> thanks for your reply, i tried this, but in my case it doesn't work. I
>>> made a function that first sets the configuration types (using your line of
>>> code) and then calls the project function. Using this function instead of
>>> the project function itself, still all configurations are beeing generated.
>>> I browsed through the cmake sources and modules, but i coudn't find the
>>> place that reintroduces those configurations.
>>> It looks like a bug to me, later on i will try to produce an example.
>>>
>>> Kind regards
>>> Janosch
>>>
>>>
>>> On Tue, May 28, 2013 at 10:01 PM, Eric Clark  wrote:
>>>
>>>>  Our projects limit the types to just Debug and Release. However, what
>>>> I found was that you had to set the variable before every call to
>>>> project(…). What we did was we created a module called BuildTypes.cmake and
>>>> include it first thing in every list file. The file has one line of code in
>>>> it that looks like this:
>>>>
>>>> ** **
>>>>
>>>> set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE)*
>>>> ***
>>>>
>>>> ** **
>>>>
>>>> This does the trick for us. Hope this helps…
>>>>
>>>> ** **
>>>>
>>>> Eric
>>>>
>>>> ** **
>>>>
>>>> *From:* cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] *On
>>>> Behalf Of *gaga bla
>>>> *Sent:* Tuesday, May 28, 2013 12:55 PM
>>>> *To:* cmake@cmake.org
>>>> *Subject:* [CMake] Problems setting CMAKE_CONFIGURATION_TYPES for
>>>> Visual Studio
>>>>
>>>> ** **
>>>>
>>>> Hello, I have problems reducing available configuration types for a
>>>> Visual Studio project.
>>>>
>>>> No matter what I do, the project always contains all four configuration
>>>> types.
>>>>
>>>>  
>>>>
>>>> I have two files involved, I tried to strip everything that seemed to
>>>> be unimportant:
>>>>
>>>>  
>>>>
>>>> CmakeLists.txt (Main file):
>>>>
>>>> 
>>>>
>>>> include("... Helpers.cmake")
>>>>
>>>> configureMyProject("MyProject")
>>>>
>>>> message("Config types (outside): ${CMAKE_CONFIGURATION_TYPES}")
>>>>
>>>> 
>>>>
>>>>  
>>>>
>>>> Helpers

Re: [CMake] Running "install" by default, or alternatives?

2013-05-29 Thread Petr Kmoch
Hi Paul.

Look up "generator expressions" in the CMake docs (for example in
"add_custom_command"), particularly $. It might help in
solving your issue.

Petr


On Wed, May 29, 2013 at 10:52 PM, Paul Smith  wrote:

> No love for this question apparently :-/
>
> I tried to implement the suggestion in the mailing list post below, and
> it works fine with UNIX makefiles.
>
> But, on other generators such as Xcode and MSVC there's a major problem
> that I don't know how to solve.  The post suggests forcing a new target
> like this:
>
>   add_custom_target(stage_install ALL
>   COMMAND ${CMAKE_COMMAND} -P
> "${CMAKE_BINARY_DIR}/cmake_install.cmake")
>
> which is fine for generators that don't use build types.  However for
> generators that do use build types, I don't know how to pass the build
> type into the cmake command.
>
> I found that cmake_install.cmake is reading ${BUILD_TYPE}, so I can add
> -DBUILD_TYPE=... to the $(CMAKE_COMMAND} in the stage_install target
> above if I can figure out what "..." should be.
>
> So when I run, for example, "xcodebuild build -configuration Debug", how
> do I write that custom target command so it can find the configuration
> name "Debug" that xcodebuild was invoked with?
>
>
> Basically all I can do now is hardcode the build type at cmake time, so
> if you want to use a different build type you must re-run cmake with a
> different -DCMAKE_BUILD_TYPE= flag :-/.
>
>
>
> On Fri, 2013-05-24 at 11:41 -0400, Paul Smith wrote:
> > Hi all;
> >
> > We have a large-ish set of cmake files building our project which
> > results in various executables, libraries, scripts, etc.  Currently
> > these are just left lying where they were created, and all our tests
> > etc. expect to find them there.
> >
> > Then we then have a subsequent script that we run to collect the build
> > products into a temporary staging area and create the installation
> > packages (RPMs, EXEs, etc.)  Then to run our tests on the packages we
> > have to put them in a mode where they expect to find things in those
> > "release" locations instead of the "build" location.
> >
> > This is annoying for many reasons and I want to change it so that the
> > build installs into the staging area, which has the same layout as the
> > package installation, then all our tests will use that layout and our
> > packager can just package up that staging area with little extra work.
> > I guess that the "install" capabilities of CMake are the right way to go
> > about it.
> >
> >
> > One major concern I have is that everyone has scripts, macros, etc.
> > which just run "make", or use XCode or MSVC with the default target.  If
> > I make this change, then when people forget and run the default target
> > instead of the "install" target they'll be running against the results
> > of a previous build (when they did run the "install" step), not the
> > results of the current build (where they forgot to run the "install"
> > step).  Much confusion and swearing will ensue.
> >
> > It doesn't take hardly any time to do the extra few file copies, so I
> > just want to ALWAYS install to the staging area after building.
> >
> > Is there a way to make it so that the "install" step is the default step
> > selected if you don't provide a different one?
> >
> > Or is CMake install capability not the right answer for this problem?
> >
> > Or, is a solution like this one:
> >
> > http://marc.info/?l=cmake&m=130365717914933&w=2
> >
> > still the recommended way to handle a situation like this?  Are there
> > more "official" solutions available?
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

Re: [CMake] Custom targets & dependencies causing unintended builds

2013-06-09 Thread Petr Kmoch
Hi Robert.

Whether a target is included in Visual Studio's "Build solution" is
controlled by target property EXCLUDE_FROM_DEFAULT_BUILD. Would setting it
for your custom target(s) help?

Petr


On Sat, Jun 8, 2013 at 11:57 PM, Robert Dailey wrote:

> I have two custom targets named A and B. These are not POST_BUILD
> targets, these are targets set to depend on files generated by custom
> commands. Neither custom target has the "ALL" option specified.
>
> I have called add_dependencies( A B ) to make A depend on B.
>
> When I Build Solution in Visual Studio, A does not build but B does
> build. I think because B is a dependency of A, even though A itself
> does not build, the dependency forces B to build. If I remove the
> add_dependencies() call, then neither A or B builds (desired
> behavior).
>
> If I run a build on ALL_BUILD, then regardless of dependencies set,
> neither A or B build (desired behavior).
>
> This seems like a defect to me. When I go to Configuration Manager
> (Right click solution -> Configuration Manager), I see that B is has
> the check box under "Build" checked. This is supposed to be unchecked.
> Basically when I make B a dependency of A, and B is a custom target,
> it should exclude B from the build unless 1) A has a dependency or 2)
> B has been created with the ALL option.
>
> Comments?
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--

Powered by www.kitware.com

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

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

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

[CMake] Why install(TARGETS ...) from current CMakeList only?

2013-07-29 Thread Petr Kmoch
Hi all.

We have a setup where subprojects register "items" they wish to install,
and the top-project later processes them (removing some, modifying others
etc.) and issues install(...) commands for them. Currently, this does not
work for install(TARGETS ...), as that command can only be given in the
CMakeList which defined the target.

I'm curious about the reason for this limitation - why can't a target's
installation be controlled by a different CMakeLists.txt file? Could anyone
shed some light on this?

Thanks.

Petr
--

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] CMake with Team Foundation Server?

2013-08-28 Thread Petr Kmoch
Hi Fabian.

CMake has support for generating Scc* properties in projects; see target
properties VS_SCC_*
Since version 2.8.11, there's also support for generating arbitrary
GlobalSections in .sln files; see directory properties VS_GLOBAL_SECTION_*

You should be able to use these to generate the necessary bindings as part
of running CMake.

Petr


On Wed, Aug 28, 2013 at 10:33 AM, Fabian Saccilotto wrote:

> We are starting to use CMake with TFS, as we already have solutions with
> different versions of VS and want to simplify the configuration of
> dependencies and settings with CMake.
> The problem we actually have is that the bindings to TFS are stored in the
> solution and project files. As soon as you run CMake again this bindings
> are overwritten and you loose the connection to TFS. Once you connected
> your projects to TFS and have a mapping, you can easily reconnect your
> projects via File-> Source Code Management > Manage (Or something similar,
> my VS is in german) and then select the projects which you want to bind
> again.
>
> This solution works when you don't have to change your CMake Files a lot
> (i.e adding, removing files at the beginning of a project) but is not as
> nice as if you would work with a non CMake VS Solution... I tried to find
> some information on the format of the entries in the solution files, but
> whitout success. The only thing I have is the result of a diff (see below)
> where you could guess how you could create the bindings programmatically.
> From my point of view a problem is where the local mapping is stored as
> only relative paths are stored in the solution file. Another question is
> what those GUID's exactly mean resp. where you get this information.
>
> Regards Fabian Saccilotto
>
> (Solution File)
> GlobalSection(**TeamFoundationVersionControl) = preSolution
> SccNumberOfProjects = 3
> SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-**
> 32DDF27D184C}
> SccTeamFoundationServer = 
> SccProjectUniqueName0 = 3DReconstruction\\**
> 3DReconstruction.vcxproj
> SccProjectName0 = 3DReconstruction
> SccAuxPath0 = 
> SccLocalPath0 = 3DReconstruction
> SccProvider0 = {4CA58AB2-18FA-4F8D-95D4-**32DDF27D184C}
> SccProjectUniqueName1 = 3DRecConsole\\3DRecConsole.**
> vcxproj
> SccProjectName1 = 3DRecConsole
> SccAuxPath1 = 
> SccLocalPath1 = 3DRecConsole
> SccProvider1 = {4CA58AB2-18FA-4F8D-95D4-**32DDF27D184C}
> SccProjectUniqueName2 = VanishingPointDetection\\**
> VanishingPointDetection.**vcxproj
> SccProjectName2 = VanishingPointDetection
> SccAuxPath2 = 
> SccLocalPath2 = VanishingPointDetection
> SccProvider2 = {4CA58AB2-18FA-4F8D-95D4-**32DDF27D184C}
> EndGlobalSection
>
> (Project File)
> 
> {180ABFA3-1346-**484E-8843-4E777FC7BFE9}
> Win32Proj
> Win32
> ImageTo3D
> SAK
> SAK
> SAK
> SAK
>   
>
>
> Am 27.08.2013 21:22, schrieb Zamir Khan:
>
>  In the interest of brevity (and avoiding expressing some of my biases),
>> I'll
>> try to keep the problem description short.
>>
>> We currently develop on Windows, using multiple versions of VS (2008,
>> 2010,
>> 2012 in the near future). Currently our target platform is Windows only,
>> but
>> that could change. Most of our code is native C++, but there is also some
>> C#. We use Mercurial for source control. We use CMake to generate our VS
>> projects and, after initial struggles (and hacks), I finally have a system
>> that works well to generate even our C# projects. CMake makes managing
>> dependencies relatively painless.
>>
>> However, there is an external push to move to a system that uses Team
>> Foundation Server (which we currently do not use). Mercurial and CMake
>> play
>> well together in terms of out-of-source build. Mercurial can theoretically
>> be replaced by TFS source control (without commenting on whether this is a
>> good thing). However, it's unclear to me whether TFS would play nicely (if
>> at all) with CMake.
>>
>> Basically, I'm wondering if anyone has used TFS and CMake together, to
>> what
>> extent, and what their experience has been. If Google is any indication,
>> the
>> TFS/CMake combination is exceedingly rare. Of course, another other
>> insights, even without direct experience, are welcome too.
>>
>>
>>
>> --
>> View this message in context: http://cmake.3232098.n2.**
>> nabble.com/CMake-with-Team-**Foundation-Server-tp7585293.**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

Re: [CMake] How to install files produced by custom targets

2013-09-06 Thread Petr Kmoch
Hi Lucas,

you could look into install(CODE ...) or its escaping-hell-avoiding
brother, install(SCRIPT ...). The code/script could then be something like
execute_process(COMMAND make install ...) or perhaps even
execute_process(COMMAND ${CMAKE_BUILD_TOOL} install ...).

Petr


On Fri, Sep 6, 2013 at 11:44 AM, Lucas Soltic wrote:

> Hello,
>
> Considering that I have a custom target that outputs some libraries and
> these libraries were built using configure+make. The custom library is
> based on autotools. Configure + make are executed by a custom command in
> the custom target.
>
> Is it possible to add a CMake install rule that will execute 'make
> install' on my custom library? So that the install process is automatically
> handled.
>
> I'm asking that because at the moment I'm finding very hard to install a
> custom library only with classical CMake install rules, because I cannot
> know in advance the names of all the outputs because they have suffixes
> depending on the library version. And I would prefer to avoid hardcoding
> these versions, so that I can easily update my library.
>
> Regards,
> Lucas
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to install files produced by custom targets

2013-09-06 Thread Petr Kmoch
I just wanted to point out the existence of CMAKE_BUILD_TOOL, as it's
related. In your case, however, you're probably better off hardcoding
'make'. It should actually be done the same way you run 'make' in your
custom command creating the library.


On Fri, Sep 6, 2013 at 2:08 PM, Lucas Soltic  wrote:

>
> Le 6 sept. 2013 à 12:58, Petr Kmoch  a écrit :
>
> Hi Lucas,
>
> you could look into install(CODE ...) or its escaping-hell-avoiding
> brother, install(SCRIPT ...). The code/script could then be something like
> execute_process(COMMAND make install ...) or perhaps even
> execute_process(COMMAND ${CMAKE_BUILD_TOOL} install ...).
>
>
> Hi Petr,
>
> I guess execute_process() with CMAKE_BUILD_TOOL depends on whether the
> target build tool supports "install" ? Will that work when installing from
> Visual Studio for example?
>
> I need a solution that works both on Windows and Unixes :/
> I'll have a look a install(SCRIPT …).
>
> Thanks!
> Lucas
>
>
> Petr
>
>
> On Fri, Sep 6, 2013 at 11:44 AM, Lucas Soltic wrote:
>
>> Hello,
>>
>> Considering that I have a custom target that outputs some libraries and
>> these libraries were built using configure+make. The custom library is
>> based on autotools. Configure + make are executed by a custom command in
>> the custom target.
>>
>> Is it possible to add a CMake install rule that will execute 'make
>> install' on my custom library? So that the install process is automatically
>> handled.
>>
>> I'm asking that because at the moment I'm finding very hard to install a
>> custom library only with classical CMake install rules, because I cannot
>> know in advance the names of all the outputs because they have suffixes
>> depending on the library version. And I would prefer to avoid hardcoding
>> these versions, so that I can easily update my library.
>>
>> Regards,
>> Lucas
>> --
>>
>> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Bug with ninja generator on windows using CMake 2.8.11.1

2013-09-24 Thread Petr Kmoch
Hi.

I would just add that this is actually doable in one command - Windows 'cd'
accepts option '/D' which means "also change the drive, if applicable."
CMake would have to issue it, though.

Petr


On Mon, Sep 23, 2013 at 10:58 PM, Malfettone, Kris
wrote:

>  I am experiencing what I consider a bug with the Ninja generator on
> Windows.  I am using CMake 2.8.11.1 and I believe the latest Ninja from
> github.  However, I do not believe this to be version specific.
>
>
>
> Some of my builds use add_custom_command specifying WORKING_DIRECTORY as
> an argument.  When I have WORKING_DIRECTORY set to a directory on a drive
> that is not the same as my CMake build directory ninja builds will fail
> because it attempts to set the working directory by simply cd’ing to the
> WORKING_DIRECTORY.  In the windows cmd prompts this will fail because you
> need to issue 2 commands.  For instance if my CMake build directory is on
> C:\build_dir and the working directory is on Z:\working_dir ninja should
> issue:
>Z:
>
>cd Z:\working_dir
>
> instead of just:
>cd Z:\working_dir
>
>
>
> The annoying part of the bug is that the cd to Z:\working_dir command
> technically succeeds but doesn’t change the current working directory.
> Then the custom command itself will fail rather than the ninja command
> trying to cd because it is in the wrong working directory.
>
>
>
> Am I mistaken or is this the behavior that others experience as well?
>
>
>
> I imagine this would be an easy bug to fix and since I do these types of
> builds often it would be very much appreciated if it was.
>
>
>
> -Kris Malfettone
>
> --
>
> IMPORTANT: The information contained in this email and/or its attachments
> is confidential. If you are not the intended recipient, please notify the
> sender immediately by reply and immediately delete this message and all its
> attachments. Any review, use, reproduction, disclosure or dissemination of
> this message or any attachment by an unintended recipient is strictly
> prohibited. Neither this message nor any attachment is intended as or
> should be construed as an offer, solicitation or recommendation to buy or
> sell any security or other financial instrument. Neither the sender, his or
> her employer nor any of their respective affiliates makes any warranties as
> to the completeness or accuracy of any of the information contained herein
> or that this message or any of its attachments is free of viruses.
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Generating stand-alone Visual Studio projects?

2013-10-15 Thread Petr Kmoch
Hi Magnus.

I am afraid that's not really possible (safely). CMake uses absolute paths
all over the place (by design), so all output file paths etc. are hardcoded
in the .sln and .vc[x]proj files to the paths applicable where they were
generated. You can experiment with the variable CMAKE_USE_RELATIVE_PATHS,
but even its documentation warns that it's unreliable.

Petr


On Tue, Oct 15, 2013 at 10:23 AM, Magnus Therning wrote:

> Hi CMake list,
>
> A colleague and I are trying to somewhat sneak in CMake in a project
> that uses Visual Studio for IDE.  This is a fairly big step to take
> and we anticipate a bit of push-back, even if it clearly is a
> worthwhile improvement.  One way to maybe ease the transition would be
> to check in the CMake-generated solution+projects.  I took the naive
> approach and just removed the CMake-generated files, the cache etc,
> just keeping the VS solution+projects.  The next build I noticed that
> CMake was re-run and the cache was regenerated.
>
> Is there some way to get CMake to generate solution+projects that
> don't have any tie to CMake at all, its cache or CMakeLists.txt files,
> that are suitable to check into a VCS and thereby not require every
> user of the code to install CMake themselves?
>
> I am well aware of the potential problems arising from CMake not being
> a round-trip tool, i.e. that changes made to the solution+projects
> don't end up in the CMakeLists.txt automatically.  At this point in
> time that isn't a big concern for us though.
>
> /M
>
> --
> Magnus Therning  OpenPGP: 0xAB4DFBA4
> email: mag...@therning.org   jabber: mag...@therning.org
> twitter: magthe   http://therning.org/magnus
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] linkage order of static libraries and object files (ENABLE_EXPORTS)

2013-11-02 Thread Petr Kmoch
Hi Ivan.

The correct use of OBJECT libraries is not to link against them, but to
list them as sources (using a special syntax), like this:

add_executable(project main.c $)

(Assuming 'serial' is the name of the object library). This is outlined in
the documentation for OBJECT libraries.

Petr


On Sat, Nov 2, 2013 at 7:50 AM, Ivan Sergio Borgonovo
wrote:

> I'm trying to convert an embedded eclipse project to CMake with a
> python script.
>
> I reached a point where everything compile as I want, everything get
> listed in the linking step but libraries are in the wrong order and
> linking fail.
>
> Just reordering the libraries list and running the linking process by
> hand produce the right executable.
>
> I want to convert the project in a completely automatic way and I don't
> want my python code to get too complicated to understand
> inter-libraries dependencies to write smarter CMakeLists.txt files or
> to order properly the libraries unless there is a very simple way to do
> so. This would be sweet but I don't think there is a simple way.
>
> Eclipse was compiling everything as objects so order of linking was not
> important.
>
> I've tried to follow
> http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library
> I get
>
> CMake Error at cmakedirs.cmake:118 (target_link_libraries):
>   Target "serial" of type OBJECT_LIBRARY may not be linked into another
>   target.  One may link only to STATIC or SHARED libraries, or to
> executables with the ENABLE_EXPORTS property set.
> Call Stack (most recent call first):
>   CMakeLists.txt:89 (include)
>
> for all libraries
>
> But I can't get rid of the same error even when I add:
> add_executable(project main.c)
> set_target_properties(project PROPERTIES ENABLE_EXPORTS ON) #<--
>
>
> --
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] ctest - how to specify tests that must not run in parallel

2013-11-15 Thread Petr Kmoch
Hi.

There is a test property RUN_SERIAL (
http://cmake.org/cmake/help/v2.8.12/cmake.html#prop_test:RUN_SERIAL) which
prevents the test from running parallel with other tests; I believe that's
what you're looking for.

Petr


On Fri, Nov 15, 2013 at 3:39 PM, Miller Henry wrote:

>  I just switched to using ctest, which is overall much better, but when I
> run with –j it often happens that some test suite fails.  After
> investigating I discovered that the failing test is not a unit tests (ie a
> test with everything mocked out), but an integration test that is
> intentionally testing our use of global system resources.  The test is
> failing because a different integration test is also using those global
> resources and changing states.
>
> Is there a way to mark tests as using some global resource and thus not
> able to run in parallel?  My current work around is to use -R and -E to run
> the tests in question separately, but I have enough other tests that don’t
> use this global resource that everything could run in parallel if there was
> some way to tell ctest to not schedule them together, and thus increase our
> total test time.  This would also scale better than telling every developer
> who is using ctest the correct -E and -R commands to make things work.
>
> Do I open a feature request, or does this already exist?
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Select the Visual C++ Compiler November 2013 CTP with CMake generated projects?

2013-11-19 Thread Petr Kmoch
Hi Kelly.

This should be possible using CMake's command-line option -T which
specifies the toolset to use.

Petr


On Tue, Nov 19, 2013 at 4:41 PM, Thompson, K T  wrote:

>  Hi,
>
> Is there a way to tell CMake to generate Visual Studio 2013 projects that
> use the November 2013 CTP version of the compiler [1]?  It looks like I can
> modify each project in my VS solution manually [2] but this is not
> particularly convenient when CMake is used to generate the solution files.
>
> [1]
> http://blogs.msdn.com/b/vcblog/archive/2013/11/18/announcing-the-visual-c-compiler-november-2013-ctp.aspx
>
> [2] For each project, edit the properties and set "Platform Toolset" to
> "Visual C++ Compiler Nov 2013 CTP (CTP_Nov2013)".
>
>
>
> -kt
>
> Kelly Thompson
>
> k...@lanl.gov
>
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Select the Visual C++ Compiler November 2013 CTP with CMake generated projects?

2013-11-20 Thread Petr Kmoch
Yup, AFAIK, -T is not represented in the GUI yet.

Petr


On Tue, Nov 19, 2013 at 6:16 PM, Thompson, K T  wrote:

>  That did the trick.  Thank you.
>
>
>
> I was looking to set the Toolset from within the GUI, but it doesn’t
> appear that CMake current supports this operation.
>
>
>
> -kt
>
>
>
> *From:* Petr Kmoch [mailto:petr.km...@gmail.com]
> *Sent:* Tuesday, November 19, 2013 9:28 AM
> *To:* Thompson, K T
> *Cc:* cmake@cmake.org
> *Subject:* Re: [CMake] Select the Visual C++ Compiler November 2013 CTP
> with CMake generated projects?
>
>
>
> Hi Kelly.
>
> This should be possible using CMake's command-line option -T which
> specifies the toolset to use.
>
> Petr
>
>
>
> On Tue, Nov 19, 2013 at 4:41 PM, Thompson, K T  wrote:
>
> Hi,
>
> Is there a way to tell CMake to generate Visual Studio 2013 projects that
> use the November 2013 CTP version of the compiler [1]?  It looks like I can
> modify each project in my VS solution manually [2] but this is not
> particularly convenient when CMake is used to generate the solution files.
>
> [1]
> http://blogs.msdn.com/b/vcblog/archive/2013/11/18/announcing-the-visual-c-compiler-november-2013-ctp.aspx
>
> [2] For each project, edit the properties and set "Platform Toolset" to
> "Visual C++ Compiler Nov 2013 CTP (CTP_Nov2013)".
>
>
>
> -kt
>
> Kelly Thompson
>
> k...@lanl.gov
>
>
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Set executable for dll project in vs2010 with cmake

2013-11-25 Thread Petr Kmoch
Hi Elizabeta.

Unfortunately, that is not possible (directly). The reason is that settings
in the Debugging subtree of Configuration Properties are not stored in the
project files (.vc[x]proj), but in host-and-machine-specific .user files,
and CMake does not generate those (they are generated by VS the first time
a project is opened).

It is possible to work around this by generating the .user file yourself
(using `file(WRITE ...)` and similar commands); I've done it, but it's a
large-ish (and messy) chunk of work, especially if you need it to be
configurable.

Petr


On Mon, Nov 25, 2013 at 1:30 PM, elizabeta petreska <
elizabeta.petre...@gmail.com> wrote:

> Hi
> I want to set executable command for starting dll project with cmake.  The
> option  in vs2010 is in Project Properties->Configuration
> Properties->Debugging->Command
>
> Is this possible with 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

[CMake] List of places supporting generator expressions

2013-12-05 Thread Petr Kmoch
Hi all,

I was trying to figure out whether the source file property
COMPILE_DEFINITIONS supports generator expressions and I found no clear way
how to do so (so I assume it does not, because genexes aren't mentioned in
its docs).

This got me thinking: is there a list somewhere of all contexts where
generator expressions are supported? I couldn't find anything like this in
the docs or on the Wiki. Am I missing something?

In the absence of such a list, are all contexts which use generator
expressions documented as such in the CMake docs? I.e. could a list of
genex-aware contexts be created simply by collecting all parts of the
documentation which list the genex syntax or otherwise mention genex
support?

Thanks.

Petr
--

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to tell an executable where to look for libraries it depends on

2014-01-23 Thread Petr Kmoch
Hi Lucas.

There's no portable way to do that, simply because not all systems support
something like this (e.g. Windows doesn't ). For Linux, you can look into
the various options of handling RPATH (such as BUILD_WITH_INSTALL_RPATH,
SKIP_BUILD_RPATH, INSTALL_RPATH etc.).

Petr


On Thu, Jan 23, 2014 at 12:56 PM, Lucas Soltic wrote:

> Hello,
>
> Is there a CMake rule to tell an executable where to look for its dynamic
> libraries when running? So that the dependencies are correctly loaded at
> runtime.
>
> Regards,
> Lucas SOLTIC
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] ctest dependencies

2014-02-03 Thread Petr Kmoch
Hi Tom.

You might want to look into the DEPENDS property of tests.

Petr


On Sat, Feb 1, 2014 at 7:17 PM, Tom Browder  wrote:

> I have a ctest test (say, TESTA) whose success I would like to have as
> a dependency for a lot of other tests (say, TESTB, etc.).
>
> Can I do something like (pseudo code:
>
> if (TESTA passes)
>   do other tests
> else
>   msg("all tests fail due to failure of TESTA")
> endif
>
> Thanks.
>
> Best regards,
>
> -Tom
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] ctest dependencies

2014-02-03 Thread Petr Kmoch
Your tests B, C and D *depend on* test A. Therefore, you're (I believe)
looking for this:

set_test_properties(TESTB TESTC TESTD
  PROPERTY DEPENDS TESTA
)

Petr


On Mon, Feb 3, 2014 at 12:48 PM, Tom Browder  wrote:

> On Mon, Feb 3, 2014 at 3:20 AM, Petr Kmoch  wrote:
> > Hi Tom.
> >
> > You might want to look into the DEPENDS property of tests.
>
> Hi, Petr.
>
> I had looked into properties, but I'm not sure what property I'm
> looking for.  For instance I'm using:
>
>   PROPERTIES WILL_FAIL true
>
> but I need to find the property ctest gets for a pass/fail from each test.
>
> That way I can add something like
>
>   set_test_properties(TESTB TESTC TESTD
> PROPERTY TESTA_MUST_PASS true
>   )
>
> Do you know what that is or how to do it?
>
> Thanks.
>
> -Tom
>
-- 

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Dependencies

2014-02-05 Thread Petr Kmoch
Hi Phil.

If your FOO.asm is used as a source file (i.e. it's listed in an
add_executable() or add_library() command), then you can use the source
file property OBJECT_DEPENDS for that:

  add_executable(myexe FOO.asm other.file one.more)

  set_property(SOURCE FOO.asm PROPERTY OBJECT_DEPENDS BAR.mac BAZ.mac) #any
list of dependencies here

As an alternative to set_property(), you can use the weaker, but shorthand
setter set_source_files_properties() (which can set it for multiple files
at once).

If they're somehow processed with a custom command/target (i.e. via
add_custom_command() or add_custom_target() instead of library/executable),
you can use that command's DEPENDS argument.

Petr


On Tue, Feb 4, 2014 at 7:57 PM, Phil Smith  wrote:

> This is surely something basic, but I'm far from a CMake guru and would
> rather not spend weeks digging to solve something that **seems** like
> it'll be simple.
>
>
>
> We have assembler modules in a project. These use macros, as assembler
> modules are wont to do.
>
>
>
> So if module FOO.asm uses macro BAR.mac, and we change BAR, a CMake should
> rebuild FOO. We recognize that we're going to have to define these
> dependencies manually, but I'm assuming/hoping that there's a way to do
> that in a CMakeLists.
>
>
>
> Unfortunately words like "dependency" make lousy search terms!
>
>
>
> Can someone point me? Or, even better, give me an example of how to say
> "FOO.asm depends on macro BAR.mac"?
>
>
>
> Thanks...
>
> --
>
> ...phsiii
>
>
>
> Phil Smith III
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to manage dependencies between projects in Visual Studio

2014-02-05 Thread Petr Kmoch
Hi Luca.

You could look into the CMake command include_external_msproject(), or into
the ExternalProject module.

Petr


On Wed, Feb 5, 2014 at 12:19 PM, Luca Gherardi wrote:

> I'm working with Visual Studio and I need to create the CMakeLists files
> for the following scenario.
>
>
>
> I have a project A, which contains the sources for a library.
>
> This project has its own CMakeLists and generates a lib (add_library).
>
>
>
> I have a second project B, which contains the sources from an executable
> and uses the library generated by A.
>
> I would like to setup its CMakeLists in such a way that:
>
>
>
> -The Visual Studio solution generated from the CMakeLists of B
> includes the projects for A and B
>
> -The project A should be just a link to the project generated
> with the CMakeLists of A. In other words I would like to avoid duplications
> of compilation files. I would like that the file generated for A by a
> compilation started from the solution of A were stored in the same path of
> the file generated for A by a compilation started from the solution of B.
>
>
>
> Is that possible?
>
> I know it is possible to do it with visual studio, but I don't know how to
> do it with CMake.
>
>
>
> Thanks in advance.
>
>
>
>
> --
>
> Luca Gherardi, PhD
> Postdoc at ETH Zurich
> Institute for Dynamic Systems and Control
> Room ML K 34
> Sonneggstrasse 3 - 8092 Zurich
>
> SWITZERLAND
>
>
> Office: +41 44 632 73 55
> Mobile: +41 788 833 174
> Home: http://www.lucagherardi.it
>
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] How to manage dependencies between projects in Visual Studio

2014-02-05 Thread Petr Kmoch
Sorry, I've never used either functionality myself. I just wanted to point
out what exists.

Petr


On Wed, Feb 5, 2014 at 2:04 PM, Luca Gherardi wrote:

> Hi Peter,
>
>
>
> I tried to use the include_external_msproject(PROJECT_NAME PATH_TO_VCXPROJ)
>
>
>
> The project is included in the solution, however when I try to build the
> solution VS returns the following error:
>
>
>
> "The operation could not be completed. The parameter is incorrect"
>
>
>
> No other information.
>
> Any idea?
>
>
>
> Thanks,
>
> Luca
>
>
>
>
>
>
>
> *From:* Petr Kmoch [mailto:petr.km...@gmail.com]
> *Sent:* mercoledì 5 febbraio 2014 12:34
> *To:* Luca Gherardi
> *Cc:* cmake@cmake.org
> *Subject:* Re: [CMake] How to manage dependencies between projects in
> Visual Studio
>
>
>
> Hi Luca.
>
> You could look into the CMake command include_external_msproject(), or
> into the ExternalProject module.
>
> Petr
>
>
>
> On Wed, Feb 5, 2014 at 12:19 PM, Luca Gherardi 
> wrote:
>
> I'm working with Visual Studio and I need to create the CMakeLists files
> for the following scenario.
>
>
>
> I have a project A, which contains the sources for a library.
>
> This project has its own CMakeLists and generates a lib (add_library).
>
>
>
> I have a second project B, which contains the sources from an executable
> and uses the library generated by A.
>
> I would like to setup its CMakeLists in such a way that:
>
>
>
> -The Visual Studio solution generated from the CMakeLists of B
> includes the projects for A and B
>
> -The project A should be just a link to the project generated
> with the CMakeLists of A. In other words I would like to avoid duplications
> of compilation files. I would like that the file generated for A by a
> compilation started from the solution of A were stored in the same path of
> the file generated for A by a compilation started from the solution of B.
>
>
>
> Is that possible?
>
> I know it is possible to do it with visual studio, but I don't know how to
> do it with CMake.
>
>
>
> Thanks in advance.
>
>
>
>
> --
>
> Luca Gherardi, PhD
> Postdoc at ETH Zurich
> Institute for Dynamic Systems and Control
> Room ML K 34
> Sonneggstrasse 3 - 8092 Zurich
>
> SWITZERLAND
>
>
> Office: +41 44 632 73 55
> Mobile: +41 788 833 174
> Home: http://www.lucagherardi.it
>
>
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Dependencies

2014-02-11 Thread Petr Kmoch
Quoting the documentation of OBJECT_DEPENDS:

  Specifies a semicolon-separated list of full-paths to files on which any
object files compiled from this source file depend.

Notice the "full-paths" bit. You're not providing a full path. You must
make the path absolute; you can probably prefix it with an appropriate
selection from ${CMAKE_SOURCE_DIR}, ${CMAKE_CURRENT_SOURCE_DIR},
${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_BINARY_DIR}, ${CMAKE_CURRENT_LIST_DIR}
or similar variables.

Petr


On Tue, Feb 11, 2014 at 1:12 AM, Phil Smith  wrote:

> Can I bother you to look at my CMakeLists.txt and see if you see why the
>
> *set_property(SOURCE VSHVOLT.asm APPEND PROPERTY OBJECT_DEPENDS
> src/zprotect/asm/VSHVOLTX.mac)*
>
>
>
> on line 385 doesn't seem to be "taking"?
>
>
>
> What I do is a CMake, then I edit VSHVOLTX.mac and save it, and another
> CMake. Nothing gets built. VSHVOLT.asm should get reassembled.
>
>
>
> This is driving me crazy...
>
>
>
> *From:* Petr Kmoch [mailto:petr.km...@gmail.com]
> *Sent:* Wednesday, February 05, 2014 12:08 AM
>
> *To:* Phil Smith
> *Cc:* cmake@cmake.org
> *Subject:* Re: [CMake] Dependencies
>
>
>
> Hi Phil.
>
>
> If your FOO.asm is used as a source file (i.e. it's listed in an
> add_executable() or add_library() command), then you can use the source
> file property OBJECT_DEPENDS for that:
>
>   add_executable(myexe FOO.asm other.file one.more)
>
>   set_property(SOURCE FOO.asm PROPERTY OBJECT_DEPENDS BAR.mac BAZ.mac)
> #any list of dependencies here
>
> As an alternative to set_property(), you can use the weaker, but shorthand
> setter set_source_files_properties() (which can set it for multiple files
> at once).
>
>
>
> If they're somehow processed with a custom command/target (i.e. via
> add_custom_command() or add_custom_target() instead of library/executable),
> you can use that command's DEPENDS argument.
>
> Petr
>
>
>
> On Tue, Feb 4, 2014 at 7:57 PM, Phil Smith  wrote:
>
> This is surely something basic, but I'm far from a CMake guru and would
> rather not spend weeks digging to solve something that **seems** like
> it'll be simple.
>
>
>
> We have assembler modules in a project. These use macros, as assembler
> modules are wont to do.
>
>
>
> So if module FOO.asm uses macro BAR.mac, and we change BAR, a CMake should
> rebuild FOO. We recognize that we're going to have to define these
> dependencies manually, but I'm assuming/hoping that there's a way to do
> that in a CMakeLists.
>
>
>
> Unfortunately words like "dependency" make lousy search terms!
>
>
>
> Can someone point me? Or, even better, give me an example of how to say
> "FOO.asm depends on macro BAR.mac"?
>
>
>
> Thanks...
>
> --
>
> ...phsiii
>
>
>
> Phil Smith III
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Index CMake strings

2014-03-13 Thread Petr Kmoch
Hi Micha,

the CMake equivalent code would be:

  string(SUBSTRING "${Str}" 3 1 c)

Petr


On Thu, Mar 13, 2014 at 10:27 AM, Micha Renner wrote:

> Hallo,
>
> is it possible to index CMake strings.
> In C it would something like this:
>
> char c = Str[3];
>
> Micha
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] get_directory_property and get_property

2014-04-17 Thread Petr Kmoch
Hi James.

Quoting the docs at http://www.cmake.org/cmake/help/v2.8.12/cmake.html:

"""

get_property(
wrote:

> I see that I can get the value of a variable from a directory using:
>
> get_directory_property(sub1_val1 DIRECTORY sub1 DEFINITION val1)
>
> Can I do the same thing with get_property?
>
> I see a VARIABLE entry, but I can't use that with the DIRECTORY indication.
>
> By the way what are the properties on VARIABLE that can be queried?  I
> don't see any documentation for this question.
>
> get_property(... VARIABLE PROPERTY ???)
>
> Thanks,
> James
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Adding explicit dependencies to a target

2014-05-08 Thread Petr Kmoch
Hi Tarjei.

add_custom_command() has a DEPENDS argument where you can list any number
of files which will act as dependencies for the custom command. So you
could extend your custom command like this:

add_custom_command(
  OUTPUT ... #as before
  COMMAND ... #as before
  MAIN_DEPENDENCY a.idl
  DEPENDS b.idl c.idl
  ... # rest as before
)

You have to keep in mind that this gets processed at configure time - if
you change the #include-s used in a.idl, you have to modify the CMakeList
and re-run CMake to get the changes picked up.

It should also be possible to use the IMPLICIT_DEPENDS argument of
add_custom_command() to request the C or C++ dependency scanner to run on
the file, moving the dependency detection to build time. But that only
works for Makefile generators.

Petr


On Thu, May 8, 2014 at 9:16 AM, Tarjei Knapstad
wrote:

> In our project we are generating code from CORBA IDL files by adding a
> custom command that generates C++ code from the IDL files and a library
> target that depends on the generated output. This works as expected,
> however IDL supports include directives which are (naturally) not picked up
> as dependencies by CMake. To give an example:
>
> a.idl:
> 
> #include "b.idl"
> #include "c.idl"
> -
>
> Here the file a.idl file includes b.idl and c.idl. The file a.idl is given
> as input to the custom command that processes IDL files into C++, but if I
> change b.idl or c.idl then the target is not rebuilt. Is it possible to add
> b.idl and c.idl as explicit dependencies in some way so that my target is
> rebuilt if these files change? I've made various attempts with
> add_custom_target() and add_dependencies() as well as
> set_source_files_properties() without any luck.
>
> Regards,
> --
> Tarjei
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Delay Cache File Reading

2014-05-11 Thread Petr Kmoch
Hi Ryan.

If the only thing you need delay-loaded in this are the target names, you
should just get rid of the variables and use the target names directly. The
decision whether an argument of `target_link_libraries()` is a target or a
library path is done at generate time, when all CMakeLists have been parsed
and all target names are known.

However, if your example is just simplified and you need more than the name
itself for linking (e.g. if you need to dereference a differnt variable set
in the target's CMakeList, or get/set that tartget's properties), then I'm
afraid you're out of luck in the general case. I was facing a similar setup
at work: hundreds of projects randomly referencing each other, where trying
to find an ordering of subdirectory inclusion just wasn't practically
possible. In the end, I did something similar to your "master file"
approach, but a bit more modular. I require each project to have a
"project.cmake" file alongside its "CMakeLists.txt". The "project.cmake"
file sets all the variables required by other projects. My master CMakeList
then include()-s all these "project.cmake" files before executing any
`add_subdirectory()` calls, so that all the variables are already set
correctly when subprojects are processed.

If someone has a better way to do it, I'd love to hear it as well.

Petr


On Fri, May 9, 2014 at 8:21 PM, Kawicki, Ryan H
wrote:

>  I wonder if anyone else has come into this kind of situation.
>
>
>
> We are restructuring how some of our libraries are structured on disk to
> be more modular.
>
>
>
> Previously, we had all of the project names defined in a CMakeList.txt
> that then would call to add the subdirectories that are needed.  This works
> fine, but with the new structure, we would like to eliminate the need for
> this master file and just have the subdirectories define the name itself.
>
>
>
> The thing I was thinking of doing was just adding them to the cache file,
> but order may be important here.
>
>
>
> Here is a very simple example:
>
>
>
> Master CMakeList:
>
> cmake_minimum_required(VERSION 2.8)
>
> project(test)
>
> add_subdirectory(lib2)
>
> add_subdirectory(lib)
>
> add_subdirectory(exe)
>
>
>
> lib2 CMakeList:
>
> cmake_minimum_required(VERSION 2.8)
>
> SET(PROJECT_LIB2  lib2   CACHE INTERNAL "lib2
> project name")
>
> add_library(${PROJECT_LIB2} SHARED file.cpp)
>
> target_link_libraries(${PROJECT_LIB2} ${PROJECT_LIB})
>
>
>
> lib CMakeList:
>
> cmake_minimum_required(VERSION 2.8)
>
> SET(PROJECT_LIB  lib   CACHE INTERNAL "lib
> project name")
>
> add_library(${PROJECT_LIB} STATIC file.cpp)
>
>
>
> exe CMakeList:
>
> cmake_minimum_required(VERSION 2.8)
>
> SET(PROJECT_EXE  exe   CACHE INTERNAL "exe
> project name")
>
> add_executable(${PROJECT_EXE} file.cpp)
>
> target_link_libraries(${PROJECT_EXE} ${PROJECT_LIB2})
>
>
>
> In this simple example, lib is never seen by lib2 and added as a dependant
> because the cache entry has not yet been evaluated.
>
>
>
> I thought that there was first a configuration step to acquire all
> variables of and stuff them into the cache file and then the generation
> step would use these values to generate the file output, but that is not
> happening as can be seen in the example above.  I am using CMake 2.8.11.1
> when conducting this test and generating a VS2010 project.
>
>
>
> During our restructuring efforts, we are making a full attempt at trying
> to not have these kind of situations come up, but we live in the real world
> and not an ideal world.  Outside of using the –C option or restructuring
> again, is there anything I can do to accomplish what I am trying to do?  Is
> there a mechanism to delay reading from the cache until the configuration
> step has finished?
>
>
>
> Thanks.
>
>
>
> Ryan H. Kawicki
>
> --
>
> 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://www.cmake.org/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.kitwa

Re: [CMake] Wanted: Interface link options

2014-06-13 Thread Petr Kmoch
Hi Andres.

I cannot comment on the property request itself, but you should be able to
work around its absence by using `-` instead of `/` to introduce the linker
option - the Visual Studio tools understand both, AFAIK.

Petr


On Fri, Jun 13, 2014 at 1:42 PM, Anders Lindgren  wrote:

> Hi!
>
> I have a third party-library only available in Release flavor. When
> building a Debug configuration, I need to pass the option
> /NODEFAULTLIB:libcmt to the Visual Studio linker.
>
> I have been playing around with the new target interface system. However,
> I'm missing a way for a library to specify linker options, that would
> transitively affect targets that use the library (just like the
> INTERFACE_COMPILE_OPTIONS and INTERFACE_LINK_LIBRARIES do for compiler
> options and libraries, respectively).
>
> So, I suggest adding a INTERFACE_LINK_OPTIONS target property. That way I
> would add the library using:
>
> add_library(the_library.lib STATIC IMPORTED)
> set_property(TARGET the_library.lib
>   PROPERTY INTERFACE_LINK_OPTIONS
> $<$:/NODEFAULTLIB:libcmt>)
>
> In addition, there are two properties, COMPILE_FLAGS and COMPILE_OPTIONS,
> with the difference that the latter understands generator expressions. I
> also suggest adding a LINK_OPTIONS along the same lines.
>
> (Note that the INTERFACE_LINK_LIBRARIES property is designed to contain
> both libraries and linker options. However, an entry is only interpreted as
> an option if it starts with a "-", which is not the case for Visual Studio
> options.)
>
> Sincerely,
> Anders Lindgren
>
>
> --
>
> 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://www.cmake.org/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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Passing empty arguments to add_custom_command

2014-06-30 Thread Petr Kmoch
I think it should work if you put quotes around the expansion - otherwise,
an empty variable expands to nothing, not to an empty string:


*add_custom_command(*

*OUTPUT ${some_files}*

*COMMAND ${PYTHON_EXECUTABLE} test.py "${prefix}" ${src} ${dst}*
*DEPENDS ${... all deps ..} )*

Petr


On Mon, Jun 30, 2014 at 1:13 PM, abid rahman  wrote:

> Thank you Nils, VERBATIM really worked for me as shown below:
>
>
> *add_custom_command(*
>
> *OUTPUT ${some_files}*
>
> *COMMAND ${PYTHON_EXECUTABLE} test.py "" ${src} ${dst} *
>
> *DEPENDS ${... all deps ..}*
> *VERBATIM )*
>
> But now got a new question. I tried setting a variable and passing it, but
> it didn't work. as shown below:
>
>
>
> *set(prefix "")add_custom_command(*
>
> *OUTPUT ${some_files}*
>
> *COMMAND ${PYTHON_EXECUTABLE} test.py ${prefix} ${src} ${dst}*
> *DEPENDS ${... all deps ..} )*
>
> Any idea why?
>
> Abid K.
>
>
> On Mon, Jun 30, 2014 at 1:35 PM, Nils Gladitz 
> wrote:
>
>> On 06/30/2014 09:42 AM, abid rahman wrote:
>>
>>> Hello,
>>>
>>> I need to execute following  command with add_custom_command:
>>> *python test.py "" src dst*
>>>
>>>
>>> The first argument is empty. Sometimes it may have some text. So Python
>>> process the args as [test.py, "", src, dst]. But when I do the same with
>>> add_custom_command, the empty argument is not considered, instead src is
>>> considered as second argument.
>>>
>>> I did it as follows:
>>>
>>> *add_custom_command(
>>> *
>>> *OUTPUT ${some_files}
>>> *
>>> *COMMAND ${PYTHON_EXECUTABLE} test.py "" ${src} ${dst}
>>> *
>>> *DEPENDS ${... all deps ..} )*
>>>
>>>
>>> So what is the best method to pass empty arguments to cmake
>>> add_custom_command?
>>> Abid K.
>>>
>>
>> Try adding VERBATIM.
>>
>> Nils
>>
>>
>
> --
>
> 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] How do I create a dependency to copy (touched) resource files when building an executable?

2014-06-30 Thread Petr Kmoch
Hi Eric.

It seems to me that you're copying from source dir to binary dir, but all
dependencies are on the source dir file only. Therefore, there is nothing
to trigger the generation of the binary-dir file. Perhaps you wanted
'fooresources' to depend on the binary-dir file instead?

Petr


On Mon, Jun 30, 2014 at 3:20 PM, Eric Wing  wrote:

> I need to copy resource files from the source directory to the binary
> directory with the creation of my executable. I want CMake's
> dependency tracking to handle (re)copying these files whenever the
> source has been touched.
>
> Looking at other similar questions like:
>
> http://stackoverflow.com/questions/17018477/cmake-adding-custom-resources-to-build-directory
> and the CMake FAQ: How can I add a dependency to a source file which
> is generated in a subdirectory?
> http://www.cmake.org/Wiki/CMake_FAQ
>
> I expected the following (simplified) code to work, but it doesn't. I
> see the add_custom_target processed in the make chain, but the
> add_custom_command never triggers.
>
>
>
> project(foo)
>
> cmake_minimum_required(VERSION 2.8)
>
> add_executable(fooexe
> ${CMAKE_SOURCE_DIR}/foo.c
> ${CMAKE_SOURCE_DIR}/asset1.lua
> #   ${CMAKE_SOURCE_DIR}/subdir/subasset1.lua
> )
>
> add_custom_command(
> OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/asset1.lua"
> COMMAND ${CMAKE_COMMAND} -E copy_if_different
> "${CMAKE_SOURCE_DIR}/asset1.lua"
> "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/"
> DEPENDS "${CMAKE_SOURCE_DIR}/asset1.lua"
> COMMENT "Copying asset1.lua"
> )
>
> # files are only copied if a target depends on them
> add_custom_target(fooresources ALL DEPENDS "${CMAKE_SOURCE_DIR}/asset1.lua"
> COMMENT "fooresources custom target"
> )
> ADD_DEPENDENCIES(fooexe fooresources)
>
>
>
> Would somebody explain to me the correct way to handle this?
>
>
> Thanks,
> Eric
> --
>
> 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] How do I create a dependency to copy (touched) resource files when building an executable?

2014-06-30 Thread Petr Kmoch
Simply change the custom target to depend on the binary-dir file; it will
become driver of the custom command, like this:

add_custom_target(fooresources ALL DEPENDS "${CMAKE_BINARY_DIR}/${CMAKE_
CFG_INT}/asset1.lua"
COMMENT "fooresources custom target"
)

Petr

On Mon, Jun 30, 2014 at 4:12 PM, Eric Wing  wrote:

> Thanks for the reply. So the usage case is that people are going to be
> modifying the resources in the source directory. (These changes have
> to be checked into revision control.) So I'm having trouble seeing how
> depending on the binary directory is going to work. (The reason I must
> copy the resources to the binary directory is it is impossible to
> launch the application through the debugger or otherwise.)
>
> Thanks,
> Eric
>
>
> On 6/30/14, Petr Kmoch  wrote:
> > Hi Eric.
> >
> > It seems to me that you're copying from source dir to binary dir, but all
> > dependencies are on the source dir file only. Therefore, there is nothing
> > to trigger the generation of the binary-dir file. Perhaps you wanted
> > 'fooresources' to depend on the binary-dir file instead?
> >
> > Petr
> >
> >
> > On Mon, Jun 30, 2014 at 3:20 PM, Eric Wing  wrote:
> >
> >> I need to copy resource files from the source directory to the binary
> >> directory with the creation of my executable. I want CMake's
> >> dependency tracking to handle (re)copying these files whenever the
> >> source has been touched.
> >>
> >> Looking at other similar questions like:
> >>
> >>
> http://stackoverflow.com/questions/17018477/cmake-adding-custom-resources-to-build-directory
> >> and the CMake FAQ: How can I add a dependency to a source file which
> >> is generated in a subdirectory?
> >> http://www.cmake.org/Wiki/CMake_FAQ
> >>
> >> I expected the following (simplified) code to work, but it doesn't. I
> >> see the add_custom_target processed in the make chain, but the
> >> add_custom_command never triggers.
> >>
> >>
> >>
> >> project(foo)
> >>
> >> cmake_minimum_required(VERSION 2.8)
> >>
> >> add_executable(fooexe
> >> ${CMAKE_SOURCE_DIR}/foo.c
> >> ${CMAKE_SOURCE_DIR}/asset1.lua
> >> #   ${CMAKE_SOURCE_DIR}/subdir/subasset1.lua
> >> )
> >>
> >> add_custom_command(
> >> OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/asset1.lua"
> >> COMMAND ${CMAKE_COMMAND} -E copy_if_different
> >> "${CMAKE_SOURCE_DIR}/asset1.lua"
> >> "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/"
> >> DEPENDS "${CMAKE_SOURCE_DIR}/asset1.lua"
> >> COMMENT "Copying asset1.lua"
> >> )
> >>
> >> # files are only copied if a target depends on them
> >> add_custom_target(fooresources ALL DEPENDS
> >> "${CMAKE_SOURCE_DIR}/asset1.lua"
> >> COMMENT "fooresources custom target"
> >> )
> >> ADD_DEPENDENCIES(fooexe fooresources)
> >>
> >>
> >>
> >> Would somebody explain to me the correct way to handle this?
> >>
> >>
> >> Thanks,
> >> Eric
> >> --
> >>
> >> 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
> >>
> >
>
>
> --
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
>
-- 

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] How do I create a dependency to copy (touched) resource files when building an executable?

2014-06-30 Thread Petr Kmoch
The reasoning is this: when a target is about to be built, it checks its
dependencies and if any are out of date (or don't exist), it triggers their
building. The binary-dir file is built by the custom command. So when the
custom target is built, it will check its dependency (the binary-dir file)
and trigger a run of the custom command which is registered to OUTPUT that
file.

Petr


On Mon, Jun 30, 2014 at 4:25 PM, Eric Wing  wrote:

> Okay, I switched just the add_custom_target DEPENDS to the binary
> directory (but left the add_custom_command alone). That seems to be
> doing what I need. I think I'm still not fully understanding the
> reasoning behind it, but problem solved I guess.
>
> Thanks,
> Eric
>
>
> On 6/30/14, Eric Wing  wrote:
> > Thanks for the reply. So the usage case is that people are going to be
> > modifying the resources in the source directory. (These changes have
> > to be checked into revision control.) So I'm having trouble seeing how
> > depending on the binary directory is going to work. (The reason I must
> > copy the resources to the binary directory is it is impossible to
> > launch the application through the debugger or otherwise.)
> >
> > Thanks,
> > Eric
> >
> >
> > On 6/30/14, Petr Kmoch  wrote:
> >> Hi Eric.
> >>
> >> It seems to me that you're copying from source dir to binary dir, but
> all
> >> dependencies are on the source dir file only. Therefore, there is
> nothing
> >> to trigger the generation of the binary-dir file. Perhaps you wanted
> >> 'fooresources' to depend on the binary-dir file instead?
> >>
> >> Petr
> >>
> >>
> >> On Mon, Jun 30, 2014 at 3:20 PM, Eric Wing  wrote:
> >>
> >>> I need to copy resource files from the source directory to the binary
> >>> directory with the creation of my executable. I want CMake's
> >>> dependency tracking to handle (re)copying these files whenever the
> >>> source has been touched.
> >>>
> >>> Looking at other similar questions like:
> >>>
> >>>
> http://stackoverflow.com/questions/17018477/cmake-adding-custom-resources-to-build-directory
> >>> and the CMake FAQ: How can I add a dependency to a source file which
> >>> is generated in a subdirectory?
> >>> http://www.cmake.org/Wiki/CMake_FAQ
> >>>
> >>> I expected the following (simplified) code to work, but it doesn't. I
> >>> see the add_custom_target processed in the make chain, but the
> >>> add_custom_command never triggers.
> >>>
> >>>
> >>>
> >>> project(foo)
> >>>
> >>> cmake_minimum_required(VERSION 2.8)
> >>>
> >>> add_executable(fooexe
> >>> ${CMAKE_SOURCE_DIR}/foo.c
> >>> ${CMAKE_SOURCE_DIR}/asset1.lua
> >>> #   ${CMAKE_SOURCE_DIR}/subdir/subasset1.lua
> >>> )
> >>>
> >>> add_custom_command(
> >>> OUTPUT "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/asset1.lua"
> >>> COMMAND ${CMAKE_COMMAND} -E copy_if_different
> >>> "${CMAKE_SOURCE_DIR}/asset1.lua"
> >>> "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INT}/"
> >>> DEPENDS "${CMAKE_SOURCE_DIR}/asset1.lua"
> >>> COMMENT "Copying asset1.lua"
> >>> )
> >>>
> >>> # files are only copied if a target depends on them
> >>> add_custom_target(fooresources ALL DEPENDS
> >>> "${CMAKE_SOURCE_DIR}/asset1.lua"
> >>> COMMENT "fooresources custom target"
> >>> )
> >>> ADD_DEPENDENCIES(fooexe fooresources)
> >>>
> >>>
> >>>
> >>> Would somebody explain to me the correct way to handle this?
> >>>
> >>>
> >>> Thanks,
> >>> Eric
> >>> --
> >>>
> >>> 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
> >>>
> >>
> >
> >
> > --
> > Beginning iPhone Games Development
> > http://playcontrol.net/iphonegamebook/
> >
>
>
> --
> Beginning iPhone Games Development
> http://playcontrol.net/iphonegamebook/
>
-- 

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] Resetting CMAKE_Fortran_FLAGS for a specific file

2014-08-13 Thread Petr Kmoch
Hi Marco.

Sane compilers allow later command-line options to override earlier ones,
so what you're doing should be fine. Unfortunately, I know some Fortran
compilers are not sane in this regard.

If you really need to solve this by explicitly modifying the global list
for a particular file, the only thing I can think of is move those files to
a separate CMakeList and turn them into an object library:

# In normal CMakeList:

add_subdirectory(special_file_dir)

add_executable(YourNormalTarget normal_file1.f90 normal_file2.f90
$)


# In special_file_dir/CMakeLists.txt:

set(CMAKE_Fortran_FLAGS "-only -flags -you -want")

add_library(special_files OBJECT special_fil1.f90 special_file2.f90)


I haven't tested it, but it should work.

Petr


On Tue, Aug 5, 2014 at 4:29 PM, marco restelli  wrote:

> Hi,
>I would like to reset CMAKE_Fortran_FLAGS for one specific file in
> a project. I have tried
>
> SET_SOURCE_FILES_PROPERTIES(my_file.f90 PROPERTIES COMPILE_FLAGS "-O0 -g")
>
> but it appends the new flags keeping the old ones. How can reset these
> flags? Specifically, I have some files for which I need to avoid any
> error checking and any optimization, independently from the selected
> compiler.
>
> Thanks, regards,
>Marco
> --
>
> 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] Using a custom preprocessor

2014-08-18 Thread Petr Kmoch
Hi Paul.

The straightfroward way to do thisis with custom commands:

add_custom_command(
  OUTPUT ${CMAKE_BINARY_DIR}/foo.f
  COMMAND custom_preproc foo.fs -o ${CMAKE_BINARY_DIR}/foo.f
  MAIN_DEPENDENCY foo.fs
  COMMENT "Custom-preprocessing foo.fs"
  VERBATIM
)

add_executable(myexe
  ${CMAKE_BINARY_DIR}/foo.f
  main.f90
)

Analogously with cs, of course. See documentation of add_custom_command()
for all options available.

Petr



On Fri, Aug 15, 2014 at 7:47 AM, Paul Anton Letnes  wrote:

> Hi!
>
> I am currently working on a project which uses plain old make as a build
> system. Needless to say, adding new compilers etc. is a lot of work, so I
> would like to start using CMake, which I have had excellent experience with
> in the past.
>
> There is one peculiarity that I do not know how to handle. Some of our
> code (C and Fortran) is contained in files that end with .cs or .fs, which
> are run through an in-house preprocessor. A Makefile target is then
> something along the lines of (but not exactly)
>
> foo.o: foo.f
> $(FC) -c $(FFLAGS) foo.f
>
> foo.f: foo.fs
> custom_preproc foo.fs -o foo.f
>
> Is it possible to, somehow, add this pre-compilation step for such files,
> and then
> add_executable(myexe
> foo.fs
> bar.cs
> main.f90)
> ?
>
> Cheers,
> Paul
> --
>
> 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] add_custom_command and CONFIG-dependent output

2014-08-25 Thread Petr Kmoch
On Mon, Aug 25, 2014 at 1:07 PM, David Cole via CMake 
wrote:

> > Ah, thanks... Though, I think there may be a general disconnect here:
> > that is, it seems likely that one would want to construct output with
> > a pattern composed from generator expressions.
> > ...
> > While I gather from your comment that something like this might be
> > possible in the future, is there some other general approach that can
> > be taken with current CMake?
>
>
> The "disconnect" is that generator expressions were bolted on top of
> existing CMake functionality, and are not fully supported in all
> contexts. The documentation for add_custom_command [1] explicitly says
> "Arguments to COMMAND may use “generator expressions”" -- but it says
> nothing about OUTPUT using them at all.
>
> I don't know if there's a strong reason behind not supporting them in
> the OUTPUT clause... but I suspect if it was easy, it would have been
> done already.
>

Brad suggests it's far from easy in this bug comment:
http://public.kitware.com/Bug/view.php?id=12877#c28315


>
> For now, any OUTPUT you need to specify will have to be done without
> the use of generator expressions. In some cases, that means you need to
> know what the behavior of CMake is (like the library file name in your
> example), and duplicate it if you need it in the OUTPUT clause. So, no:
> no general approach that I know of, but you can use CMAKE_CFG_INTDIR as
> needed to separate the output of different config builds...
>
> (If I'm wrong here, I do hope somebody else more intimately involved
> with generator expressions will chime in and correct me.)
>
>
> HTH,
> David C.
>
>
> [1] http://www.cmake.org/cmake/help/v3.0/command/add_custom_command.html
>

Petr
-- 

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] Need to know the ASM flag that needs to be modified in cmake

2014-08-26 Thread Petr Kmoch
Hi Ravi,

I've never used ASM_MASM (or any other language beside C, CXX and Fortran),
but if it follows normal CMake language rules, the following variables
should exist:

CMAKE_ASM_MASM_FLAGS
CMAKE_ASM_MASM_FLAGS_

(where  is a placeholder for uppercase configuration name).

See the list of per-language variables in the docs:
http://www.cmake.org/cmake/help/v3.0/manual/cmake-variables.7.html#variables-for-languages

Petr


On Tue, Aug 26, 2014 at 6:28 AM, Ravi Raman  wrote:

>  Hi,
>
>
>
> In our cmake project, there is an assembler file (.asm extension) that
> needs to be compiled to create object file (.obj) using microsoft macro
> assembler (ml.exe for 32-bit and ml64.exe for 64-bit)
>
> This is happening successfully.
>
> But there is a preprocessor directive (_WIN64) as follows within the .asm
> code, which is not getting set.
>
> IFDEF _WIN64
>
> We would like to know which is the ASM related cmake flag variable that
> needs to be manipulated in order to set _WIN64
>
>
>
> Details as follows:
>
> 1.   In CMakeLists.txt, we do the following to enable microsoft macro
> assembler to compile .asm files
>
> enable_language(ASM_MASM)
>
> 2.   We include the .asm file Testx64.asm in the source list
>
> 3.   Because of the above enable_language step, the MASM step gets
> correctly triggered as follows with the following ml64.exe options to
> compile the .asm to create corresponding .obj
>
> _MASM:
>
>   Assembling ..\..\..\testx64\Testx64.asm...
>
>   cmd.exe /C
> "C:\Users\raman_r\AppData\Local\Temp\tmp8a9b40c55523496e9edce668c1f812a2.cmd"
>
>   ml64.exe /c /nologo /Zi /Fo"testx64.dir\Release\Testx64.obj" /W3
> /errorReport:prompt  /Ta..\..\..\testx64\Testx64.asm
>
>
>
> Note that in the above step 3, ml64.exe execution creates the output
> object file Testx64.obj, but in this there is no pre-processor switch /D
> _WIN64
>
>
>
> Is there a way in cmake to manipulate any ASM related cmake flag, so that
> the above ml64.exe execution has /D _WIN64 option set ?
>
>
>
> Thanks & Regards
>
>
>
> *Ravi Raman *
>
> *Xoriant Solutions Pvt. Ltd*
>
> 4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076,
> INDIA.
>
> Tel: +91 22 30511000,9930100026 Extn: 2144 Voip No. 4088344495/96/97/98
> Voip Extn:1178| Fax: +91 22 3051
>
> ravi.ra...@xoriant.com | http://www.xoriant.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
>
-- 

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] Global dependency

2014-08-26 Thread Petr Kmoch
Hi Jonas.

As a hacky solution, you could override add_library() and add_executable(),
like this:

function(add_library targetName)
  _add_library(${targetName} ${ARGN})
  add_dependencies(${targetName} BuildInfoDateTime)
endfunction()

Petr



On Wed, Aug 27, 2014 at 5:44 AM, Jonas Lippuner  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi all,
>
> I have a custom target called BuildInfoDateTime that generates a *.cpp
> file containing the date and time of the build. I specified the target
> with ALL, so it gets run if I simply type make. However, I would also
> like all other targets (executables and libraries) to depend on
> BuildInfoDateTime. Of course, I can add the dependency manually, but
> that is tedious and could be forgotten when new targets are added.
>
> So, is there a way to make all targets depend on my custom target
> BuildInfoDateTime?
>
>
> Thanks,
> Jonas
>
>
> - --
> My email is signed and I encrypt email on request.
> To verify my signature or send me encrypted email,
> get my public key: http://lippuner.ca/key
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1
>
> iQIcBAEBAgAGBQJT/VQTAAoJELH92qHy0gnt08AP/1rjVLQ5n0L6+VsW98H0MC3s
> ccHipuwsvoCZX01R1/q/NS3e+5QV4Lx/MplhBysucM+eNesmzFPq0u5DlPI/G6wm
> KGbLGCQnczx7nWI1Dsso0lkj1bOxsMaa83u4LL0xn9g5UJUpzRI2MMgFzasLfOcA
> e4mkQKpp6O3asQ56DECvzg3RwZRgrjIi7UAKbxyO1U6p/3XmkYzzIAFoJxfeABNi
> 5LD0SS1W1aVTUrBseu+puADC4I8K5zit7uI7zlIyujxyFyj+7SkBmvYKrgXs18nR
> Y2ycy/nruUMIxblYIdm723Tu+T9+Y51qZvHbLVuJGKergVFCjsIntkjXMcmbqyLD
> Q/uAKFSRzYOlYHPsNrNkQbuaB7dM3VDGMCtfZiJQQaWGZpI58Iyqgr0JaY+pFXPC
> ZskjI1BH7T5uKy5KG+XMfZSbSFzUi2woZpMYPROQi0DqCfgIpLiZsnyHcD6erzMv
> DTkmciltZTn0/u953lJWj7lH+8vxSRJm7KLcFmpKRMI8Nq6YLXUkQBj/1gtIt8q/
> Y98qHJOM/IcrW2hUC6i1s5yQGqgV60tzBFCVOkG/GTO9uUbA4KyXYw/lUDyb0lq+
> oKkCS0EsOIiscQxfemFwVh/sO8Vqap2Az4JaxrM8s8YDP3otYtVXBL/nn2sYrOwv
> 4BEjtuSuvJf/mz0EiqYQ
> =p1nK
> -END PGP 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
>
-- 

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] compilation order dependencies,

2014-08-27 Thread Petr Kmoch
Hi Lukasz.

I believe you could put `main.cpp` into an object library:

add_library(foo ${foosources})
add_library(bar ${barsources})
add_library...
...
...
add_library(main_sources OBJECT main.cpp)
add_executable(foo_exe $)
target_link_libraries(foo_exe foo bar ... ... ...)

This should make `main.cpp` compilable independently, as only the linking
of foo_exe will wait until the libraries (including the object one) are
finished.

Petr


On Wed, Aug 27, 2014 at 10:30 AM, Łukasz Tasz  wrote:

> Dear experts,
>
> I hit the wall again with order of compilation in generated Makefiles,
>
> Uscase:
>
> add_library(foo ${foosources})
> add_library(bar ${barsources})
> add_library...
> ...
> ...
> add_executable(foo_exe main.cpp)
> target_link_libraries(foo_exe foo bar ... ... ...)
>
> while libs objects will be compiled in parallel, man.cpp.o will be
> compiled after linking of all libs,
> If main.cpp is compiling long then this is overall additional waist of
> time which could be done much earlier.
>
> Do you have some ideas how this situation could be optimised?
>
> with best regards
> Łukasz Tasz
> --
>
> 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] Fail target if buildtype is not RelWithDebInfo

2014-08-27 Thread Petr Kmoch
Hi Thomas,

you should be able to make this work using the variable CMAKE_CFG_INTDIR:

if (WIN32)
  add_custom_target(msi-installer
COMMAND IF NOT "${CMAKE_CFG_INTDIR}" == "RELWITHDEBINFO" (echo
"msi-installer only works for build type RELWITHDEBINFO" && exit 1)
COMMAND ...)
endif()

Petr


On Wed, Aug 27, 2014 at 1:21 PM, Thomas Sondergaard 
wrote:

> Hi,
>
> I have a custom target that is only enabled on Windows and it only works
> with buildtype RelWithDebInfo. When a developer accidentally runs it under
> a different configuration it doesn't fail in a very obvious way, and I'd
> like to improve that, if possible. I am using the "Visual Studio 12" (2013)
> generator.
>
> I imagine something like this
>
> if (WIN32)
> add_custom_target(msi-installer
>   COMMAND if NOT "%CMAKE_BUILD_TYPE%" ==
> "RELWITHDEBINFO" (echo "msi-installer only works for build type
> RELWITHDEBINFO" && exit 1)
>   COMMAND ...)
> endif()
>
> But that requires the CMAKE_BUILD_TYPE to be in the environment. Is there
> a way to do what I want?
>
> Thanks,
> Thomas
>
> --
>
> 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] Incorrect object file name on cmake compilation

2014-09-10 Thread Petr Kmoch
Hi Ravi.

In what sense is the name "incorrect?" There is no correct/incorrect way to
name object files in relation to the source file name; it can be arbitrary,
as long as it's correctly passed on to the linker. I believe CMake chooses
to append ".obj" to the whole file name if there is more than one file with
the same base name. But why should this be a problem?

Petr

On Thu, Sep 11, 2014 at 7:59 AM, Ravi Raman  wrote:

>  Hi,
>
>
>
> We are working on a cmake project.
>
>
>
> The issue is that the cmake build is successful but after the execution of
> cmake build step, the name of the object file is incorrect. On compilation
> of the source file main.cpp, the name of the object file is coming
> incorrectly as main.cpp.obj instead of main.obj
>
>
>
> To simulate the problem, please find attached herewith a zip file that
> contains
>
> CMakeLists.txt
>
> main.cpp
>
> main.rc
>
> The source list contains “main.cpp” and the resource file “main.rc”
>
>
>
> Please note the following:
>
> 1.   This problem occurs only when the resource file main.rc is
> present in the list.
>
> 2.   This problem does not occur when the resource file main.rc is
> excluded from the list OR if the resource file has a name other than main.rc
>
>
>
> Thanks & Regards
>
>
>
> *Ravi Raman *
>
> *Xoriant Solutions Pvt. Ltd*
>
> 4th Floor, Winchester, Hiranandani Business Park, Powai, Mumbai 400076,
> INDIA.
>
> Tel: +91 22 30511000,9930100026 Extn: 2144 Voip No. 4088344495/96/97/98
> Voip Extn:1178| Fax: +91 22 3051
>
> ravi.ra...@xoriant.com | http://www.xoriant.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
>
-- 

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] Incorrect object file name on cmake compilation

2014-09-11 Thread Petr Kmoch
I was wondering about this as well. Ravi, what is your motivation for
having object file names of a particular format? I don't think I've ever
had to care what object files in our builds are called.

Petr

On Thu, Sep 11, 2014 at 10:01 AM, Andreas Mohr  wrote:

> Hi,
>
> > Date: Thu, 11 Sep 2014 07:49:23 +
> > From: Ravi Raman 
>
> > Hi,
> >
> > Thanks Petr for your reply. By incorrect I meant instead of the
> conventional main.obj, we get main.cpp.obj.
> > I understood what you are saying. We have found a solution for this in
> our cmake code.
>
> Good, so you've found a "solution" - to which, umm, I dare ask...
> "problem" exactly? :)
>
> > We have explicitly set the /Fo compiler flag for main.cpp. With that it
> creates main.obj for main.cpp and also main.res for main.rc
>
> Why does this need some manual effort (and of manually adding a very
> specific compiler flag syntax, in fact!)
> when it ideally/normally/usually shouldn't,
> one would want to ask.
> Perhaps this "issue" is indicative of an asymmetric/incomplete mechanism
> or configuration
> in CMake or this specific CMake environment, which one might want to
> discover and fix,
> in order to have the need for any manual tweaking (in all sufficiently
> standard cases)
> avoided in all future deployments...
>
> Thanks,
>
> Andreas Mohr
>
-- 

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] how to force assign sequence in multi-thread in cmake

2014-09-15 Thread Petr Kmoch
Hi.

I've never worked with ExternalProject myself, so I can't comment with
certainty, but from what I understand, the correct way of using
ExternalProject is to add your own project as an ExternalProject as well.
Basically, the toplevel CMakeList becomes a superbuild which *only* does
ExternalProject_Add() calls and does not add any libraries/executables
directly. After you build the superbuild once to get all the dependencies
correct, you switch to the "external" project of your own code and work
with that normally.

Petr

On Mon, Sep 15, 2014 at 4:13 PM, Yu Jing  wrote:

> I had asked in http://stackoverflow.com/questions/25841602  , someone
> told me maybe here is a better place to ask.
>
> I am writing a project base on crfpp , a external project. I use cmake to
> integerate this project as follow .
>
> firstly , I add a extenal project like this:
>
> EXTERNALPROJECT_ADD(
> CRFPP_EX_PROJ
> GIT_REPOSITORY g...@github.com:yujing5b5d/crfpp.git
> PREFIX ${CMAKE_CURRENT_BINARY_DIR}
> CONFIGURE_COMMAND ./configure
> BUILD_COMMAND make -j8
> BUILD_IN_SOURCE 1
> INSTALL_COMMAND cp .libs/libcrfpp.a ${PROJECT_BINARY_DIR}/lib && 
> cp crfpp.h ${PROJECT_BINARY_DIR}/include
> )
>
> this will generate some .a file and copy a header file crfpp.h to folder
> ${PROJECT_BINARY_DIR}/include , which is included in my project.
>
> and then , use the ${PROJECT_BINARY_DIR}/include as include path as
> follow .
>
> INCLUDE_DIRECTORIES(
> ${PROJECT_SOURCE_DIR}/include
> ${PROJECT_BINARY_DIR}/include)
>
> finally , when I compile the main project , code like this :
>
> ADD_EXECUTABLE(cmake_sample main.cc)
> ADD_DEPENDENCIES(cmake_sample CRFPP_EX_PROJ)
> TARGET_LINK_LIBRARIES(cmake_sample crfpp)
>
> In general , if I just build a build folder, compile like this :
>
> cmake ..
> make
>
> It may works fine, compile the external project first , and copy the
> header file to desired place , and then continue compile main.cc in my
> project . But if I use compile command as multi-thread like this :
>
> cmake ..
> make -j8
>
> It will not works because my main.cc and the external project are
> processed at same time, so it report a error like this :
>
> /Users/yu/Workspace/res/cmake_sample/src/main.cc:3:10: fatal error: 'crfpp.h' 
> file not found#include "crfpp.h" // crfpp
>  ^1 error generated.
>
> This crfpp.h will generated after CRFPP_EX_PROJ , but in multi-thread
> environment , the sequence is quite different .
>
> My Question is : Is it possible that force let my project compile after
> these external projects all finished . BE CAREFUL , I'm not sure is this
> the problem of my use of ADD_DEPENDENCIES , I also wrote
>
> ADD_DEPENDENCIES(cmake_sample CRFPP_EX_PROJ)
>
> but it seems not works ?
>
> Thanks for any help.
>
>
>
> --
>
> 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] CMAKE_INSTALL_PREFIX problem

2014-09-23 Thread Petr Kmoch
Hi Jeremy.

Does ${BUILD_BIN} perhaps start with a slash? If so, it would be
interpreted as an absolute path, which of course ignores
CMAKE_INSTALL_PREFIX.

Petr

On Wed, Sep 24, 2014 at 7:58 AM, Jeremy Ardley 
wrote:

>  I am using cmake 2.8.9 on debian wheezy. I'm fairly new to using cmake.
>
> My CMakelists.txt file starts with
>
> cmake_minimum_required(VERSION 2.6)
> SET(CMAKE_INSTALL_PREFIX /home/jeremy/Projects/local/)
> project(myproject)
>
> 
>
> Finishing with
>
> INSTALL ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/@APPLICATION_NAME@ DESTINATION 
> @${BUILD_BIN} )
>
> which installs in my target directory, but under a tree prefixed by the
> '@' character. i.e. /home/jeremy/Projects/local/@/sbin and equivalent.
>
> I'm guessing that this is a result of the fragment
>
> @${BUILD_BIN}
>
> The problem is that if I remove the '@' the INSTALL ignores the
> CMAKE_INSTALL_PREFIX
>
> I've experimented with different variations on the INSTALL lines to no
> success.
>
> Any advice on how to get my INSTALLS ending up in
> /home/jeremy/Projects/local/sbin and equivalent?
>
> Thanks
>
> --
>  Jeremy Ardley
>
> --
>
> 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] CMAKE_INSTALL_PREFIX problem

2014-09-23 Thread Petr Kmoch
I don't know why @ was inserted, but here's why it overrides the absolute
path: because it has no special meaning. The path then becomes "@/sbin",
which is not an absolute path (doesn't start with '/'), so the install
prefix is prepended normally. Bear in mind that Unix directory and file
names can contain any characters except '/' and NUL.

About variable substitution:

${var} is the normal way to expand variables.

@var@ is primarily intended for use with configure_file(). I believe it
works during normal CMake runs as well, but don't use it like that, it will
only add confusion.

Petr

P.S. Please keep the list in copy when replying.

On Wed, Sep 24, 2014 at 8:45 AM, Jeremy Ardley 
wrote:

>  It was
>
> set (BUILD_BIN /sbin)
>
> Removing that fixed the problem. Thanks!
>
> Curious why my IDE inserted the '@' (kdevelop 3) And more so why it
> overrides the absolute path?
>
> I need to discover more about value substitution :=(
>
> @somekey@ vs ${somekey}
>
>
> On 24/09/14 14:39, Petr Kmoch wrote:
>
>  Hi Jeremy.
>
>  Does ${BUILD_BIN} perhaps start with a slash? If so, it would be
> interpreted as an absolute path, which of course ignores
> CMAKE_INSTALL_PREFIX.
>
> Petr
>
> On Wed, Sep 24, 2014 at 7:58 AM, Jeremy Ardley 
> wrote:
>
>>  I am using cmake 2.8.9 on debian wheezy. I'm fairly new to using cmake.
>>
>> My CMakelists.txt file starts with
>>
>> cmake_minimum_required(VERSION 2.6)
>> SET(CMAKE_INSTALL_PREFIX /home/jeremy/Projects/local/)
>> project(myproject)
>>
>> 
>>
>> Finishing with
>>
>> INSTALL ( PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/@APPLICATION_NAME@ 
>> DESTINATION @${BUILD_BIN} )
>>
>> which installs in my target directory, but under a tree prefixed by the
>> '@' character. i.e. /home/jeremy/Projects/local/@/sbin and equivalent.
>>
>> I'm guessing that this is a result of the fragment
>>
>> @${BUILD_BIN}
>>
>> The problem is that if I remove the '@' the INSTALL ignores the
>> CMAKE_INSTALL_PREFIX
>>
>> I've experimented with different variations on the INSTALL lines to no
>> success.
>>
>> Any advice on how to get my INSTALLS ending up in
>> /home/jeremy/Projects/local/sbin and equivalent?
>>
>> Thanks
>>
>> --
>>  Jeremy Ardley
>>
>> --
>>
>> 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
>>
>
>
>
> --
>  Jeremy Ardley
>
-- 

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] Linked Imported Library in Visual Studio Showing NOTFOUND

2019-04-17 Thread Petr Kmoch
Hi Dustyn,

ELF platforms link against .so files, but Windows links against import
libraries (.lib files) assocaited with DLLs. Does the target 'bar' have the
IMPORTED_IMPLIB property set up correctly? (See
https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB.html )

Petr

On Tue, 16 Apr 2019 at 21:37, Dustyn Blasig  wrote:

> Hi All,
>
> I'm trying to debug an issues where an imported shared library is showing
> up in the linker command as not found, but within the CMake generation the
> target seems to exist.
>
> # CMakeLists.txt 
>
> include(bar.cmake)
>
> add_library(foo SHARED)
>
> if(TARGET bar)
>   target_link_libraries(foo PUBLIC bar)
> endif()
>
> # bar.cmake ###
>
> add_library(bar SHARED IMPORTED)
>
> ...
>
>
> On Linux, the link command contains the correct *-L* and *-lbar*
> options. However, on Windows (Visual Studio) the linker command has
> "bar-NOTFOUND" instead of bar.lib as it should, even though bar should only
> be added as a dependency *if* it exists.
>
> How can I debug why this would happen? Is there a way to have CMake dump
> more information about that target?
>
> Thanks!
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] transitive linkage of OBJECT library targets

2019-05-22 Thread Petr Kmoch
Hi Richard,

does it help if you specify the linking as PUBLIC? I.e.:

target_link_libraries(second_object_lib PUBLIC first_object_lib)

Petr

On Wed, 22 May 2019 at 07:48, Richard Szabo  wrote:

> Hi cmakers
>
> I'm trying to get the following example working:
> ```
> cmake_minimum_required(VERSION 3.14)
> project(test_object_lib_nesting)
>
> set(CMAKE_CXX_STANDARD 14)
>
> add_library(first_object_lib OBJECT first.cpp)
>
> add_library(second_object_lib OBJECT second.cpp)
>
> target_link_libraries(second_object_lib first_object_lib)
>
> add_executable(test_object_lib_nesting main.cpp)
>
> target_link_libraries(test_object_lib_nesting second_object_lib)
> ```
>
> The problem I have that the linker command line will have only the
> second.cpp.o for linking the first.cpp.o will not be added as link
> object to the exe. Causing missing symbols on exe linkage.
>
> How to transitively resolve and link "nested" Object library targets ?.
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Question about config_file.

2019-06-10 Thread Petr Kmoch
Hi Steven.

"what is the configure_file command for?"

https://cmake.org/cmake/help/latest/command/configure_file.html

"what is Doxygen.in?"

Check its contents at wherever you found the example for details, but it
should be a template for the Doxygen configuration file (the config file
read by Doxygen).

Petr

On Sun, 9 Jun 2019 at 00:18, Steven Truppe  wrote:

> Hi everyone,
>
> currently i'm trying to build my doxygen documentation from my
> CMakeLists.txt file. I found the following example that seems to be
> correct:
>
> ##
> ## bsBuildDoxygen() ##
> ##
> macro(bsBuildDocs)
>   if(GENERATE_DOCS)
>   # check if Doxygen is installed
>   find_package(Doxygen)
>   if(DOXYGEN_FOUND)
>   # set input and output files
>   set(DOXYGEN_IN 
> ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile.in)
>   set(DOXYGEN_OUT 
> ${CMAKE_CURRENT_SOURCE_DIR}/doc/manual/Doxyfile)
>
>   # request to configure the file
>   configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
>   message("Doxygen build started")
>
>   # note the option ALL which allows to build the docs 
> together with the application
>   add_custom_target( doc_doxygen ALL
>   COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
>   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
>   COMMENT "Generating API documentation with 
> Doxygen"
>   VERBATIM )
>   else()
> message("Doxygen need to be installed to generate the doxygen 
> documentation")
>   endif()
>   endif()
> endmacro()
>
> Now my question is about the configure_file command. what is Doxygen.in
> and what is the configure_file command for ?
>
>
> best regards!
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] set_target_properties ( INTERFACE_INCLUDE_DIRECTORIES ...)

2019-09-12 Thread Petr Kmoch
For completeness, there is also OPTION C:

  set_property(TARGET target PROPERTY INTERFACE_INCLUDE_DIRECTORIES
directory1 directory2)

set_target_properties() is a shorthand for setting several properties at
once, so it assumes its arguments are prop value prop value. If you need
finer control, such as appending or easy way to pass multiple values, use
the full power of set_property().

Petr

On Fri, 13 Sep 2019 at 06:24, Theodore Hall  wrote:

> On Thu, Sep 12, 2019 at 6:31 PM Craig Scott 
> wrote:
>
> OPTION A: Put quotes around a semi-colon separated string if using
>> set_target_properties():
>>
>
> Many thanks.  I had tried quotes, and I had tried a semi-colon, and I
> thought that I had tried them together, but evidently I missed that
> permutation.
>
> I'm actually sticking with OPTION B anyway -- it seems cleaner.  But I was
> mystified looking for OPTION A.
>
> --
>
> Ted Hall
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Recover help text from option() ?

2019-10-09 Thread Petr Kmoch
Hi Ellon.

On Wed, 9 Oct 2019 at 09:51, Ellon Paiva  wrote:

> Hi there,
>
> I was wondering if there was a way to recover the help text passed to an
> option to be used later below in the same CMake script.
>
> I saw that the help text goes into a comment before the option on the
> CMakeCache.txt, but is it stored in any recoverable variable during the
> script processing ?
>
>
Since option() just creates a cache variable, you should be able to
retrieve that variable's HELPSTRING property (
https://cmake.org/cmake/help/latest/prop_cache/HELPSTRING.html ):

  option(SampleOpt "Help")
  get_property(result CACHE SampleOpt PROPERTY HELPSTRING)

Petr
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Recover help text from option() ?

2019-10-09 Thread Petr Kmoch
On Wed, 9 Oct 2019 at 11:11, Ellon Paiva  wrote:

> Another somehow related question: is there a way to recover the name of
> all options defined in a project?
>
>
>
You should be able to get this by reading the directory property
CACHE_VARIABLES (
https://cmake.org/cmake/help/latest/prop_dir/CACHE_VARIABLES.html ) and
going from there (querying variable types etc.), but note that it's
"intended for debugging purposes." Please read the docs on cache variable
properties (
https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-on-cache-entries
) to see what's possible.

Petr
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Using generator expression with add_library

2019-11-07 Thread Petr Kmoch
Hi.

The argument STATIC or SHARED is processed at CMake configure time (that
is, when CMake is executing the add_library() command). However, generator
expressions are only evaluated at generate time, which comes only after all
CMake code is processed.

Fortunately for you, compiler ID is something that is already known at
configure time, meaning you don't need to use a genex to read it. You can
just do this:

if(MSVC)
  set(LibType STATIC)
else()
  set(LibType SHARED)
endif()
add_library(
  ${_star_lib_name}
  ${LibType}
  ...
)

(Feel free to modify the if(), use CMAKE__COMPILER_ID (
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html)
etc. as necessary).

Petr

On Thu, 7 Nov 2019 at 12:28, David Aldrich 
wrote:

> I want to build a shared library for Linux and a static library for
> Windows. So I have tried:
>
>  set (_star_lib_name "StdStars")
>
>  add_library(${_star_lib_name}
>  $<$:SHARED>
>  $<$:STATIC>
>  ""
>  )
>
> but that gives me error:
>
> CMake Error at 
> C:/SVNProj/zodiac/branches/TRY_TML_CMake_3Oct2019/StarLibs/StdStars/CMakeLists.txt:7
>  (add_library):
> Cannot find source file:
>
> STATIC
>
>   Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
>   .hpp .hxx .in .txx
>
> What is the correct way of doing this please?
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Missing dll on program startup - a way automate it?

2019-11-20 Thread Petr Kmoch
Hi.

I haven't used it yet, but I believe the target property
https://cmake.org/cmake/help/latest/prop_tgt/VS_DEBUGGER_ENVIRONMENT.html
might help you.

Petr

On Wed, 20 Nov 2019 at 01:02, cen  wrote:

> Hi
>
> Perhaps not really a cmake problem but here we go. An exe depends on a
> few DLLs which I ship in the repo so the rest of the devs don't have to
> build them or fetch them somewhere else. Cmake finds the libraries and
> project builds just fine, until you run it from VS.. you are welcomed by
> the "missing dll" windows error. So I have to copy all the dlls to the
> build/run folder to make it work but this is a manual step. Is there
> some way in cmake/VS to somehow tell the IDE to append the execution
> $PATH with all the specified library dependencies or something along
> those lines? Ideally my goal is to just run cmake, open VS, build the
> project and run, all automagical.
>
> I would prefer to keep the dynamic linking.
>
>
> Best regards, cen
>
> --
>
> Powered by kitware.com/cmake
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit https://cmake.org/services
>
> Visit other Kitware open-source projects at
> https://www.kitware.com/platforms
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
> This mailing list is deprecated in favor of https://discourse.cmake.org
>
-- 

Powered by kitware.com/cmake

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

Visit other Kitware open-source projects at https://www.kitware.com/platforms

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

This mailing list is deprecated in favor of https://discourse.cmake.org


Re: [CMake] How to handle options with more than two possible values?

2016-10-13 Thread Petr Kmoch
Hi.

option() is a handy shortcut for boolean options, but it's little more than
syntactic sugar for a cache variable of type BOOL. To create a tristate
variable, you can do this:

  set(ENABLE_SOMETHING AUTO CACHE STRING "Enable SOMETHING support")  #
create the variable
  set_property(CACHE ENABLE_SOMETHING PROPERTY STRINGS AUTO ON OFF)  #
define list of values GUI will offer for the variable

Then, you can test the variable like this:

  if(ENABLE_SOMETHING STREQUAL "AUTO")
# AUTO was used
  elseif(ENABLE_SOMETHING)
# a true value (such as ON) was used
  else()
# a false value (such as OFF) was used
  endif()

Hope this helps.

Petr

On 13 October 2016 at 13:32, YuGiOhJCJ Mailing-List via CMake <
cmake@cmake.org> wrote:

> Hello,
>
> Regarding the cmake-commands manual [1], the "option" command seems to
> take as argument a boolean constant that can have the two possible values:
> ON or OFF.
>
> I would like to use three possible values for an option: AUTO (as default
> value), ON or OFF.
>
> Example:
> option(ENABLE_SOMETHING "Enable SOMETHING support" AUTO)
>
> But of course this example is wrong because "AUTO" is not ON or OFF.
>
> Regarding the cmake-commands manual [2], the "if" command seems to return
> TRUE when the boolean constant is 1, ON, YES, TRUE, Y, or a non-zero number.
> It returns FALSE when the boolean constant is 0, OFF, NO, FALSE, N,
> IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND.
>
> I would like to check the value myself.
>
> Example:
> if(ENABLE_SOMETHING=AUTO)
> message(STATUS "ENABLE_SOMETHING=AUTO")
> endif()
> if(ENABLE_SOMETHING=ON)
> message(STATUS "ENABLE_SOMETHING=ON")
> endif()
> if(ENABLE_SOMETHING=OFF)
> message(STATUS "ENABLE_SOMETHING=OFF")
> endif()
>
> But of course this example is wrong because "=" is not accepted for an
> expression in a "if" command.
>
> So my question is: How to handle options with more than two possible
> values?
>
> Thank you.
> Best regards.
>
> [1] https://cmake.org/cmake/help/v3.7/command/option.html
> [2] https://cmake.org/cmake/help/v3.7/command/if.html
> --
>
> 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] CMAKE_INCLUDE_CURRENT_DIR on a function

2016-10-24 Thread Petr Kmoch
Hi Tiago.

Yes, Craig's original comment applies. Targets do not have scope, variables
do. Because you're in a function, you'd need to set the variable using
PARENT_SCOPE to have it apply outside the function:

function(AddTest)
  #...
  set(CMAKE_INCLUDE_CURRENT_DIR ON PARENT_SCOPE)
  #...
endfunction()

Note that this will only help if the funciton is called directly; if called
from another function, it will fail again (since the variable would just be
set in the calling function's scope and not at global level).

However, taking a step back, I believe setting the variable doesn't belong
into the `AddTest` function at all. Looking at it, it seems to be concerned
with creating and setting up one target. IMO, such a function should not
also modify global state. Do not forget that CMAKE_INCLUDE_CURRENT_DIR is
not target-specific in any way; it affects *all* targets in the current
directory.

Therefore, my suggestion would be to move setting it out of the function
altogether and perform it at CMakeList scope. Alternatively, put the
function's declaration into a separate CMake file, along with the set()
command. Then, whoever wants to use the function has to include() that
file, which will also cause them to have CMAKE_INCLUDE_CURRENT_DIR set
accordingly.

Petr

On 25 October 2016 at 00:55, Tiago Macarios  wrote:

> Hi Craig,
>
> Maybe my problem description was lacking. Below is the function I have.
> Both CMAKE_INCLUDE_CURRENT_DIR and the target are defined on the same
> function scope, but this does not seem to work. I need to define
> CMAKE_INCLUDE_CURRENT_DIR on the parent CMakeLists file.
>
> function(AddTest)
> set(options)
> set(oneValueArgs FILE FOLDER)
> set(multiValueArgs LIBRARIES)
> cmake_parse_arguments(TEST
> "${options}"
> "${oneValueArgs}"
> "${multiValueArgs}"
> ${ARGN}
> )
>
> # THIS DOES NOT WORK HERE I NEED TO SET IT IN THE PARENT FOLDER
> set(CMAKE_INCLUDE_CURRENT_DIR ON)
>
> get_filename_component(FILE_RAW ${TEST_FILE} NAME_WE)
> add_executable(${FILE_RAW} ${TEST_FILE})
>
> set_target_properties(${FILE_RAW}
> PROPERTIES
> CXX_STANDARD 14
> CXX_EXTENSIONS OFF
> AUTOMOC ON
> AUTOUIC ON
> FOLDER ${TEST_FOLDER}
> )
>
> find_package(Qt5Test)
> target_link_libraries(${FILE_RAW} ${TEST_LIBRARIES})
>
> add_test(NAME ${FILE_RAW} COMMAND ${FILE_RAW})
> endfunction()
>
>
>
>
>
>
>
>
>
>
>
> On Mon, Oct 24, 2016 at 3:48 PM, Craig Scott 
> wrote:
>
>> function() introduces a new scope, so if you want changes you make to
>> variables inside the function to be visible outside the function, you need
>> to use set(... PARENT_SCOPE). Alternatively, a macro() does not introduce a
>> new scope, so replacing your function() with a macro() may also yield the
>> behaviour you want (but changing to a macro has other effects, so make sure
>> you read the docs before going down that path). Also note that setting it
>> in one directory does not make it apply to subdirectories as well, in case
>> that matters in your situation.
>>
>>
>>
>> On Tue, Oct 25, 2016 at 9:42 AM, Tiago Macarios 
>> wrote:
>>
>>> Hi,
>>>
>>> Does CMAKE_INCLUDE_CURRENT_DIR need to be set outside of a function?
>>>
>>> I have a function where I define an executable "add_executable". This
>>> executable uses moc'ed Qt clasees, so I need to set
>>> CMAKE_INCLUDE_CURRENT_DIR. It seems like I have to set it from the top
>>> level script calling the function. If I set it inside the function the
>>> compilation fails with a missing moc file.
>>>
>>> Any ideas?
>>>
>>> Tiago
>>>
>>> --
>>>
>>> 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
>>>
>>
>>
>>
>> --
>> Craig Scott
>> Melbourne, Australia
>> https://crascit.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/u

Re: [CMake] clean custom_target

2016-10-25 Thread Petr Kmoch
Hi Tiago.

The best I can think of is the directory property
ADDITIONAL_MAKE_CLEAN_FILES:
https://cmake.org/cmake/help/latest/prop_dir/ADDITIONAL_MAKE_CLEAN_FILES.html

You can set it to a list of files which will be removed as part of running
`make clean` or its equivalent for other generators.

Petr

On 26 October 2016 at 04:36, Tiago Macarios  wrote:

> Hi,
>
> Is there a way to have a command to be run during a clean?
>
> I have a custom_target which does a fair bit of things and it also has the
> ability to clean up after itself. So conceptually something like this is
> what I am looking for:
>
> add_custom_target(Name ALL
> COMMAND command
> COMMAND_CLEAN command -clean
> )
>
>
> Tiago
>
> --
>
> 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] Intel C Generator for Cmake?

2017-02-15 Thread Petr Kmoch
Hi Tony,

generators are for different *buildsystems*: a generator for Makefiles, a
generator for Visual Studio solutions, a generator for Ninja files, a
generator for Eclipse projects etc.

Intel C and Intel Fortran are compilers, not buildsystems. You should be
able to use them with any generator whose buildsystem supports those
compilers.

On Windows, CMake supports generation of vfproj files using the Visual
Studio generator. I don't know if Intel C has its own Visual Studio project
type in the same fashion, and if so, whether CMake supports it.

One of the setups I maintain uses Visual Studio's C++ compiler and Intel
Fortran compiler on Windows using the Visual Studio generator, and
conceptually, it's as simple as this:

call ...\ifortvars.bat ...
set FC=ifort
cmake ...

Petr

On 15 February 2017 at 12:34, Tony Garratt  wrote:

> I am having to switch to cmake from autotools for a third party tool I
> want to build. We use Intel C and Intel Fortran on Windows. I see no
> mention of an Intel C generator for cmake. I presume this means there is
> not one? If so, can I create my own Intel C generator please?
>
> Rgeards,
> Tony
>
> --
> *Dr Tony Garratt*
>
>
-- 

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] Question about transitive deps and static libs.

2017-04-18 Thread Petr Kmoch
Hi,

I will offer an alternative phrasing based on what makes me personally
understand this best. It might potentially be useful for the documentation
update you're planning.

`target_link_libraries(A B)` specifies that the code in A needs B to be
added to the produced binary when the binary is *linked*. However, static
libraries are not produced by linking, but by an archiver or librarian
tool. Therefore, B needs to be present for the actual linking step when
this happens further down the chain (when linking an executable or shared
library), regardless of the "privacy" of B in A.

Petr

On 18 April 2017 at 17:44, Eric Noulard  wrote:

> Answering to myself.
>
> This mail by Craig explains a lot:
> https://cmake.org/pipermail/cmake/2016-May/063400.html
>
> Sorry for the noise. I guess I have my answer in there.
> I'll try to propose a documentation update based on Craig's explanation
> because,
> https://cmake.org/cmake/help/v3.8/manual/cmake-buildsystem.
> 7.html#transitive-usage-requirements
>
> does not contains clues on specific treatment for static libs.
>
>
>
>
> 2017-04-18 16:30 GMT+02:00 Eric Noulard :
>
>> I have a question concerning the transitive linking of dependence and
>> static libs.
>>
>> I'm working a on prokect where some shared lib are linked to static lib
>> (do not ask me why).
>> So I do:
>>
>> set(CMAKE_POSITION_INDEPENDENT_CODE True)
>>
>> then I have a bunch of libraries (either static or shared) which depends
>> on each other.
>> I use PRIVATE and PUBLIC specification with target_link_librairies.
>>
>> Now I expected that the transitive link properties would be fullfilled
>> simply i.e. that
>> when some target LIB1 is PRIVATEly link against say pthread. Then if a
>> another
>> lib LIB2 is linked against LIB1 then then "pthread" wouldn't be dragged
>> into the link
>> interface of LIB2.
>>
>> It seems that this is not as simple as I thought and as soon as LIB1 is
>> static
>> then LIB2 gets the dependency (be it PRIVATE or PUBLIC)...
>>
>> Find attached a small example.
>>
>> Is this a bug, a feature or something I didn't catch?
>>
>>
>> --
>> Eric
>>
>
>
>
> --
> Eric
>
> --
>
> 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] Errors when writing manifest

2017-07-06 Thread Petr Kmoch
Hi all.

I'm on Windows and I'm building my CMake project using MSVC. When I select
Visual Studio as the CMake generator, everything works perfectly. However,
when I use either the NMake or Ninja generator (in a properly configured
command prompt), most of my DLL linking steps fail with the following error:

  C:/Program Files (x86)/Windows Kits/8.1/bin/x64/mt.exe : general error
c101008d: Failed to write the updated manifest to the resource of file
"path\to\the.dll". The operation failed.

Re-running the exact same command (`nmake` or `ninja`) without doing
anything else occasionally solves the problem (it seemed to me it was
solved more often with NMake than with Ninja, but I can't be sure), but now
I've reached a point where all remaining DLLs consistently fail to link due
to the manifest issue.

I'd be happy to try to debug/locate the issue myself, but since the error
message I get is so wonderfully unhelpful, I don't know *how* to look into
it, or even where to start. Would anyone have any ideas how to look what
the issue could be?

My googling came up with two possibilities: a race with an antivirus for
checking the binary file, or write protection on the output directory. I've
verified that the directory in not write-protected, and it's in a location
which is excluded from AV checks. And anyway, if either of these were the
cause, I'd expect the exact same errors when using the Visual Studio IDE to
build, but such errors *never* happen there.

Any ideas?

Petr
-- 

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] Non OBJECT libraries and population of $

2017-07-10 Thread Petr Kmoch
Hi David.

In your particular case, you don't have build everything twice. Just make
the SHARED libraries thin wrappers around the OBJECT libraries. Like this:

add_library(obj1 OBJECT a.cpp b.cpp ...)
add_library(lib1 SHARED $)

add_library(obj2 OBJECT c.cpp d.cpp ...)
add_library(lib2 SHARED $)

add_library(combined SHARED $ $)

Petr

On 10 July 2017 at 19:41, David Hunter  wrote:

> Currently you can create an OBJECT library using "add_library(
> OBJECT ...)" this populates $  which can then
> later be used using something like
> "target_sources(name PUBLIC $)". I am wondering if
> there  is some reason that $ can't be populated when
> you create a shared or static library, for instance using
> "add_library( SHARED ...)". Looking at the output the VS 2017
> generators for "add_library( OBJECT ...)" it seems to actually
> build a static library anyway. I suspect that all the  files are
> compiled to object files somewhere for both STATIC and SHARED libraries,
> if so would it not be possible to point $ as these
> object files?
>
> The reason I ask is that we have a a bunch of source code that builds
> in about 100 projects. These projects have a normal hierarchical
> dependency tree. However when distributing we want to create larger
> libraries that are the combination of various subsets of the smaller ones.
> In automake these are called convenience libraries and I suspect they may
> have been the reason for CMake OBJECT in the first place. Given the current
> behaviour we have to build all the projects twice once in SHARED library
> form on once in OBJECT library form. If TARGET_OBJECTS was populated for
> SHARED libraries we would not need to build everything twice as we could
> build everything SHARED but still use TARGET_OBJECTS to build combination
> convenience libraries.
>
> Of course maybe there's already a way to do this without having to
> build twice which I don't know about.
>
-- 

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] Cannot get a 64-bit build of MySQL on a 64-bit Windows machine

2017-07-11 Thread Petr Kmoch
Hi,

when generating a Visual Studio buildsystem with CMake, you can specify the
target architecture. If you don't, the default is 32-bit.

To specify the architecture, either put it into the generator name:

  cmake .. -G "Visual Studio 15 2017 Win64" 

or specify just the architecture using -A:

  cmake .. -A Win64 

See description of -G and -A in CMake docs:
https://cmake.org/cmake/help/latest/manual/cmake.1.html

Petr

On 10 July 2017 at 22:06, A.M. Sabuncu  wrote:

> I am completely new to CMake, and am using to build MySQL 5.7.18 on
> Windows 10 x64, using the following command:
>
> cmake .. -DDOWNLOAD_BOOST=1 -DWITH_BOOST="C:\Boost" -DENABLE_DOWNLOADS=1
>
> I have VS 2017 installed, and I am on 64 bit machine, but for some reason,
> the above command produces the following output:
>
> The CXX compiler identification is MSVC 19.10.25019.0
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio/2017/Professional/VC/Tools/MSVC/14.10.25017/bin/HostX86/x86/cl.exe
> -- works
>
> The correct compiler is in the HostX64/x64 folder.
>
> Thinking that CMake might be looking it up from there, I checked the
> processor architecture environment variable from the same cmd.exe that I
> launched the CMake command from, and here's the result:
>
> PROCESSOR_ARCHITECTURE=AMD64
>
> When I follow the above CMake command with the following:
>
> devenv MySQL.sln /build RelWithDebInfo
>
> I get 32-bit results generated, which is not what I want.
>
> How can I get CMake to generate a 64-bit build?
>
> Thanks so much.
>
>
> --
>
> 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] Can not get C++ 11 support enabled

2017-07-11 Thread Petr Kmoch
As others have suggested, moving the add_executable() after the set() calls
is the correct solution.

The reason is that variables like CMAKE_CXX_STANDARD are used to
pre-initialise a target's properties when the target is created. In other
words, at the time add_executable() is called, CMake will inspect variables
like CMAKE_CXX_STANDARD and use them to initialise the target's properties
like CXX_STANDARD. It's the properties which really control the target's
build. See
https://cmake.org/cmake/help/latest/variable/CMAKE_CXX_STANDARD.html and
https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html for details.

The same applies to add_compile_options(). From its docs (
https://cmake.org/cmake/help/latest/command/add_compile_options.html ):
"Adds options to the compiler command line for targets in the current
directory and below that are added after this command is invoked"

But Craig is right that you shouldn't add `-std` directly, but use
CXX_STANDARD and CXX_EXTENSIONS instead.

Petr

On 11 July 2017 at 07:21, Craig Scott  wrote:

> As well as moving the add_executable() call after you set the various
> CMAKE_CXX... variables, you should also replace the call to
> add_compile_options(-std=c++11) with the following:
>
> set(CMAKE_CXX_EXTENSIONS OFF)
>
>
> On Tue, Jul 11, 2017 at 3:11 PM, Michael Ellery 
> wrote:
>
>>
>> > On Jul 10, 2017, at 10:07 PM, Florian Lindner 
>> wrote:
>> >
>> > Hello,
>> >
>> > my complete cmake file looks like that:
>> >
>> > cmake_minimum_required (VERSION 3.1)
>> > project(Preallocation)
>> > add_executable(prealloc prealloc_parallel.cpp)
>> >
>> > set(CMAKE_CXX_STANDARD 11)
>> > set(CMAKE_CXX_STANDARD_REQUIRED ON)
>> > add_compile_options(-std=c++11)
>> >
>> > find_library(petsc petsc
>> >  PATHS $ENV{PETSC_DIR}/$ENV{PETSC_ARCH}/lib)
>> > if(NOT petsc)
>> >  message(FATAL_ERROR "petsc was not found")
>> > endif()
>> > target_link_libraries(prealloc ${petsc})
>> >
>> > find_package(Boost 1.60.0
>> >  REQUIRED
>> >  COMPONENTS program_options)
>> > target_link_libraries(prealloc ${Boost_LIBRARIES})
>> >
>> > find_package(MPI
>> >  REQUIRED)
>> > target_link_libraries(prealloc ${MPI_LIBRARIES})
>> >
>> > set(COMPILE_FLAGS  ${COMPILE_FLAGS} ${MPI_COMPILE_FLAGS})
>> > set(LINK_FLAGS ${LINK_FLAGS} ${MPI_LINK_FLAGS})
>> >
>>
>> I would try moving the add_executable() to the end of the CMakeLists file
>> (after the set() and find_library calls…)
>>
>
-- 

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] Referencing an OBJECT library

2017-08-11 Thread Petr Kmoch
Hi Edward.

"the reference to that OBJECT library is through $" -
that is not quite true. When you're referring to the object library target
itself (e.g. reading its properties), you use its name just like with any
other target:

  get_property(someVar TARGET xxx PROPERTY TYPE)

However, the genex $ is used when you're specifying
that the sources of another target yyy are to include the objects
comprising the object library xxx:

  add_executable(yyy main.cpp $)

Here, you're not dealing with the object library xxx itself, but with the
objects from which it's composed, so you're referring to these objects
explicitly. It's quite similar to how you'd use other properties of a
target:

  target_sources(yyy $)

would similarly add all sources of target xxx to the target yyy.

Petr

On 20 July 2017 at 22:57, Edward Diener 
wrote:

> According to the CMake docs for an OBJECT library called, let's say,
> 'xxx', the reference to that OBJECT library is through
> $. I understand this but I am curious about the reason
> for such syntax. After all a STATIC or SHARED library 'xxx' you can just
> use xxx to refer to the library. Why the difference in CMake syntax
> reference between OBJECT libraries added with the add_library command and
> STATIC or SHARED libraries added with the add_library command ?
>
> --
>
> 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/opensou
> rce/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] Append to property COMPILE_DEFINITIONS

2017-08-11 Thread Petr Kmoch
On 24 July 2017 at 04:32, Florian Lindner  wrote:

>
>
> [snip]
>
> Still, I don't undertand what is wrong with:
>
> set_property(GLOBAL APPEND PROPERTY COMPILE_DEFINITIONS
> $<$:-FOO>)
>
> ?
>

What's wrong is that there is no such global property. See the list of
global properties:
https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#properties-of-global-scope

COMPILE_DEFINITIONS is not among them.

You're therefore effectively creating a new user-defined global property,
which of course has no effect on CMake's behaviour.

Petr
-- 

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] Execute CMake process not working: source directory confusion

2017-09-28 Thread Petr Kmoch
Hi Michael.

On 28 September 2017 at 18:18, Michael Powell  wrote:

> On Thu, Sep 28, 2017 at 12:06 PM, Michael Powell 
> wrote:
> > -- Forwarded message --
> > From: Michael Powell 
> > Date: Thu, Sep 28, 2017 at 12:06 PM
> > Subject: Execute CMake process not working: source directory confusion
> > To: cmake@cmake.org
> >
> >
> > Hello,
> >
> > This is fairly long, but this is intentional. I message the "Invoking"
> message.
>
> Ah, I figured it out!
>
> From the help:
>
> cmake [options] 
>
> So I simply tacked on a "\"${GIT_SUBMODULE_NNG_REPO_DIR}\"" where
>  was expected.
>
> Curious CMake would "see" the ENTIRE argument string as
> "path-to-source" though. Not sure quite what's going on with that,
> though.
>

That's because you're constructing CPPNNG_NNG_CMAKE_OPTIONS as a single
string containing spaces. Spaces *in strings* do not delimit CMake
arguments, even if spaces in CMake file syntax do. In other words:

 foo(a b c)

calls 'foo' with 3 arguments: "a", "b", and "c".

 set(args a b c)
 foo(${args})

also calls 'foo' with these 3 arguments.

However,

  set(args "a b c")
  foo(${args})

calls 'foo' with only ONE argument: the string "a b c".

You need to drop one level of quoting inside your cppnng_nng_add_* macros.


>
> The outcome wasn't quite what I expected. How do I specify "path to
> source", where the source CMakeLists.txt is, properly. And the path to
> the build, where I want the build environment to land?
>
> With this scenario, currently things are landing "in the source
> directory", which is incorrect, not what I am expecting.
>

Once you solve the quoting issue, you should be able to pass what you want
as the source directory. It's effectively the first non-option argument to
'cmake'.

The generated buildsystem lands in the working directory from which cmake
was invoked. So what you want is this:

execute_process(
  ${CMAKE_COMMAND} ${CPPNNG_NNG_CMAKE_OPTIONS} ${GIT_SUBMODULE_NNG_REPO_DIR}
  WORKING_DIRECTORY wherever/you/want/the/buildystem/to/end/up
)

Petr


>
> Probably my confusion over, prefix directory? Or is "source" directory
> where things actually land?
>
> Thanks!
>
> > Invoking CMake: C:/Dev/CMake/bin/cmake.exe -G "Visual Studio 14 2015
> > Win64" -D CMAKE_CONFIGURATION_TYPES:STRING="Debug;Release;
> MinSizeRel;RelWithDebInfo"
> > -D CMAKE_INSTALL_PREFIX:STRING="G:/Source/Spikes/nanomsg/
> cppnngswig-testing/build/nng"
> > -D NNG_ENABLE_COVERAGE:BOOL=OFF -D NNG_ENABLE_DOC:BOOL=OFF -D
> > NNG_ENABLE_NNGCAT:BOOL=OFF -D NNG_ENABLE_TESTS:BOOL=OFF -D
> > NNG_ENABLE_TOOLS:BOOL=OFF -D NNG_ENABLE_ZEROTIER:BOOL=OFF
> >
> > Prior to running:
> >
> > execute_process (
> > COMMAND "${CMAKE_COMMAND}" ${CPPNNG_NNG_CMAKE_OPTIONS}
> > WORKING_DIRECTORY "${GIT_SUBMODULE_NNG_REPO_DIR}"
> > RESULT_VARIABLE CPPNN_NNG_CONFIG_EC
> > OUTPUT_VARIABLE CPPNN_NNG_CONFIG_MSG
> > )
> >
> > Which is yielding:
> >
> > CMake Error: The source directory
> > "G:/Source/Spikes/nanomsg/cppnngswig-testing/repos/nng/ -G "Visual
> > Studio 14 2015 Win64" -D
> > CMAKE_CONFIGURATION_TYPES:STRING="Debug;Release;
> MinSizeRel;RelWithDebInfo"
> > -D CMAKE_INSTALL_PREFIX:STRING="G:/Source/Spikes/nanomsg/
> cppnngswig-testing/build/nng"
> > -D NNG_ENABLE_COVERAGE:BOOL=OFF -D NNG_ENABLE_DOC:BOOL=OFF -D
> > NNG_ENABLE_NNGCAT:BOOL=OFF -D NNG_ENABLE_TESTS:BOOL=OFF -D
> > NNG_ENABLE_TOOLS:BOOL=OFF -D NNG_ENABLE_ZEROTIER:BOOL=OFF" does not
> > exist.
> >
> > The GIT_SUBMODULE_NNG_REPO_DIR is indeed set to
> > G:/Source/Spikes/nanomsg/cppnngswig-testing/repos/nng/, so how can
> > that not be the source directory? But further, how is it seeing the
> > rest of the options as "source directory"?
> >
> > I only got to this point by doing what seems like extreme string
> > gymnastics just to arrive at what I think is an appropriate command.
> >
> > i.e.
> >
> > macro (cppnng_nng_add_cmake_generator GEN)
> > set (CPPNNG_NNG_CMAKE_OPTIONS "${CPPNNG_NNG_CMAKE_OPTIONS} -G
> \"${GEN}\"")
> > endmacro ()
> >
> > macro (cppnng_nng_add_cmake_var OPT TYPE VALUE)
> > set (CPPNNG_NNG_CMAKE_OPTIONS "${CPPNNG_NNG_CMAKE_OPTIONS} -D
> > ${OPT}:${TYPE}=${VALUE}")
> > endmacro ()
> >
> > cppnng_nng_add_cmake_generator ("${CMAKE_GENERATOR}")
> >
> > # This is like string GYMNASTICS in order to allow semi-colons to
> > properly pass through.
> > string(REPLACE ";" "\;" REPLACED_TYPES "${CMAKE_CONFIGURATION_TYPES}"
> )
> > cppnng_nng_add_cmake_var ("CMAKE_CONFIGURATION_TYPES" STRING
> > "\"${REPLACED_TYPES}\"")
> >
> > cppnng_nng_add_cmake_var ("CMAKE_INSTALL_PREFIX" STRING
> > "\"${cppnng_SOURCE_DIR}/build/nng\"")
> > cppnng_nng_add_cmake_var ("NNG_ENABLE_COVERAGE" BOOL OFF)
> > cppnng_nng_add_cmake_var ("NNG_ENABLE_DOC" BOOL OFF)
> > cppnng_nng_add_cmake_var ("NNG_ENABLE_NNGCAT" BOOL OFF)
> > cppnng_nng_add_cmake_var ("NNG_ENABLE_TESTS" BOOL OFF)
> > cppnng_nng_add_cmake_var ("NNG_ENABLE_TOOLS" BOOL OFF)
> > # TODO: TBD: at the moment we do not care about Zer

Re: [CMake] Execute CMake process not working: source directory confusion

2017-09-28 Thread Petr Kmoch
(Added list back to copy)

On 28 September 2017 at 18:53, Michael Powell  wrote:

> [...]
> >>
> >> Curious CMake would "see" the ENTIRE argument string as
> >> "path-to-source" though. Not sure quite what's going on with that,
> >> though.
> >
> >
> > That's because you're constructing CPPNNG_NNG_CMAKE_OPTIONS as a single
> > string containing spaces. Spaces *in strings* do not delimit CMake
> > arguments, even if spaces in CMake file syntax do. In other words:
> >
> >  foo(a b c)
> >
> > calls 'foo' with 3 arguments: "a", "b", and "c".
> >
> >  set(args a b c)
> >  foo(${args})
> >
> > also calls 'foo' with these 3 arguments.
> >
> > However,
> >
> >   set(args "a b c")
> >   foo(${args})
> >
> > calls 'foo' with only ONE argument: the string "a b c".
> >
> > You need to drop one level of quoting inside your cppnng_nng_add_*
> macros.
> >
> [...]
>
> Thanks for that insight!
>
> I ended up with something like this:
>
> message (STATUS "Invoking CMake: \"${CMAKE_COMMAND}\"
> ${CPPNNG_NNG_CMAKE_OPTIONS} \"${GIT_SUBMODULE_NNG_REPO_DIR}\"")
>
> execute_process (
> COMMAND "\"${CMAKE_COMMAND}\" ${CPPNNG_NNG_CMAKE_OPTIONS}
> \"${GIT_SUBMODULE_NNG_REPO_DIR}\""
> WORKING_DIRECTORY "${GIT_SUBMODULE_NNG_REPO_DIR}"
> RESULT_VARIABLE CPPNN_NNG_CONFIG_EC
> OUTPUT_VARIABLE CPPNN_NNG_CONFIG_MSG
> )
>
> But which is now yielding an output message " (Access is denied)" (no EC).
>
> Console output:
>
> Invoking CMake: "C:/Dev/CMake/bin/cmake.exe" -G "Visual Studio 14 2015
> Win64" --build "G:/Source/Spikes/nanomsg/cppnngswig-testing/build/nng"
> -D CMAKE_CONFIGURATION_TYPES:STRING="Debug\;Release\;
> MinSizeRel\;RelWithDebInfo"
> -D CMAKE_INSTALL_PREFIX:STRING="G:/Source/Spikes/nanomsg/
> cppnngswig-testing/build/nng"
> -D NNG_ENABLE_COVERAGE:BOOL=OFF -D NNG_ENABLE_DOC:BOOL=OFF -D
> NNG_ENABLE_NNGCAT:BOOL=OFF -D NNG_ENABLE_TESTS:BOOL=OFF -D
> NNG_ENABLE_TOOLS:BOOL=OFF -D NNG_ENABLE_ZEROTIER:BOOL=OFF
> "G:/Source/Spikes/nanomsg/cppnngswig-testing/repos/nng"
>

You're still putting quotes where there shouldn't be any. Look at this:

   COMMAND "\"${CMAKE_COMMAND}\" ${CPPNNG_NNG_CMAKE_OPTIONS}
\"${GIT_SUBMODULE_NNG_REPO_DIR}\""

Since the entire argument to COMMAND is in quotes, it's interpreted as the
*name* of the command you want to execute. What you want is to pass
multiple arguments to execute_process: one for the binary, and one for each
command-line argument to it. CMake will take care of proper escpaing for
you. So your code should look like this:

execute_process (
COMMAND "${CMAKE_COMMAND}" ${CPPNNG_NNG_CMAKE_OPTIONS}
"${GIT_SUBMODULE_NNG_REPO_DIR}"
WORKING_DIRECTORY "${GIT_SUBMODULE_NNG_REPO_DIR}"
RESULT_VARIABLE CPPNN_NNG_CONFIG_EC
OUTPUT_VARIABLE CPPNN_NNG_CONFIG_MSG
)

In fact, you can even drop the quotes around the variable dereferncing if
you want to; they're only necessary if the arguments can contain a
semi-colon (as that would split them into multiple CMake arguments). But
they're safe to keep.

Petr
-- 

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() with ASM fails with MSVC 19

2017-10-03 Thread Petr Kmoch
Hi Robert.

You might try leaving ASM out of project() and using enable_language()
after your call to project() (potentially in conditional branches). It can
only (reliably) be used from the toplevel CMakeList, but that sounds like
it could be good enough for you.

https://cmake.org/cmake/help/latest/command/enable_language.html

Petr


On 3 October 2017 at 17:17, Robert Dailey  wrote:

> I haven't; the bigger issue here is that the way we specify ASM
> changes depending on platform. But prior to the project() call, you
> can't really use CMake to its fullest since project() serves as
> practically an "initialize CMake" function. So there's a catch 22
> situation here.
>
> My expectation was that you specify the LANGUAGE, i.e. "ASM" and the
> platform cmake scripts within CMake's module directory would deduce
> "Ok I'm on Windows, so I know it's really MASM".
>
> On Tue, Sep 19, 2017 at 3:35 PM, Robert Maynard
>  wrote:
> > Have you tried setting the project call of project(libpng VERSION
> > 1.6.33 LANGUAGES ASM_MASM C)
> >
> > On Tue, Sep 12, 2017 at 2:34 PM, Robert Dailey 
> wrote:
> >> Also, I am using the "Visual Studio 15 2017" generator with no other
> >> options (generating through cmake-gui on Windows)
> >>
> >> On Tue, Sep 12, 2017 at 1:33 PM, Robert Dailey <
> rcdailey.li...@gmail.com> wrote:
> >>> Using CMake 3.9, I do this:
> >>>
> >>> cmake_minimum_required(VERSION 3.9)
> >>> project(libpng VERSION 1.6.33 LANGUAGES ASM C)
> >>>
> >>> I get the following error:
> >>>
> >>> -- The ASM compiler identification is unknown
> >>> -- Didn't find assembler
> >>> -- The C compiler identification is MSVC 19.11.25507.1
> >>> CMake Error at CMakeLists.txt:16 (project):
> >>> No CMAKE_ASM_COMPILER could be found.
> >>>
> >>>
> >>> Why doesn't this work?
>
-- 

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] Custom Command OUTPUTs to understand geenrator expressions?

2017-11-02 Thread Petr Kmoch
Hi Chris,

you're definitely not the first to want this (see
https://gitlab.kitware.com/cmake/cmake/issues/12877). However, as per the
comment in that issue, it's not something we can expect in any foreseeable
future.

Petr

On 1 November 2017 at 17:35, Chris Green  wrote:

> Hi,
>
> I have a case where a custom command produces multiple outputs, at least
> some of which depend on a property of a library target, viz:
>
>   if (BD_WANT_PCM)
> set(PCM_OUTPUT
>   $
> /${CMAKE_SHARED_LIBRARY_PREFIX}${dictname}_dict_rdict.pcm)
> if (GD_PCM_OUTPUT_VAR)
>   set(${GD_PCM_OUTPUT_VAR} ${PCM_OUTPUT} PARENT_SCOPE)
> endif()
>   endif()
>   add_custom_command(
> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dictname}_dict.cpp
> # Extra outputs commented out until custom_command OUTPUT supports
> # generator flags.
> ${SOURCE_OUTPUT} # ${GD_ROOTMAP_OUTPUT} ${PCM_OUTPUT}
>   ...
>
> Here, ${PCM_OUTPUT} needs to be specified to be put in the same directory
> as the library produced for the target ${dictname}_dict, which may be
> something particular to that target rather than its defaulted value of
> ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} or ${LIBRARY_OUTPUT_PATH}.
> Unfortunately, this fails to work as of CMake 3.9.2. Is this something
> which is reasonable to want and/or easy to do. Is there some other way to
> have the desired flexibility?
>
> Thanks for any help,
>
> Chris.
>
> --
>
> 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/opensou
> rce/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] Using CMake include does not seem to work intuatively

2017-12-13 Thread Petr Kmoch
Hi Saad.

I can't comment on whether the behaviour is correct or expectable, but to
get it working the way you want, you can specify the path fully:

include(${CMAKE_CURRENT_LIST_DIR}/Bar.cmake)

Petr


On 13 December 2017 at 01:34, Saad Khattak  wrote:

> Hi,
>
> Let's say I have the following directory structure:
> ~/Repos/MyRepo/CMakeLists.txt
> ~/CMakeFiles/Foo.cmake
> ~/CMakeFiles/Bar.cmake
>
> In the CMakeLists.txt I have the following command:
>
> include(~/CMakeFiles/Foo.cmake)
>
> And in Foo.cmake I have the following command:
>
> include(Bar.cmake)
>
> Turns out that he `include(Bar.cmake)` from `Foo.cmake` fails. This is
> counter to what I would expect (e.g. how #include works in C).
>
> Is this a bug or is this behavior expected? If it's expected, what is the
> workaround? We have a lot of common cmake files which in turn include files
> relative to each other and not the calling CMakeLists.txt.
>
> Thank you,
> Saad
>
> --
>
> 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] Using SET_TARGET_PROPERTIES and IMPORTED_LINK_INTERFACE_LIBRARIES

2017-12-14 Thread Petr Kmoch
Hi Saad,

have you read the docs on IMPORTED_LINK_INTERFACE_LIBRARIES? (
https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LINK_INTERFACE_LIBRARIES.html
):

  "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead."

Setting INTERFACE_LINK_LIBRARIES to "LibA;LibB" should do exactly what you
want.

As a side note, the shorthand funciton set_target_properties() and friends
are best suited when multiple properties to one value each. When setting a
list, it's usually more convenient to use the general set_property():

set_property(
  TARGET LibD
  PROPERTY INTERFACE_LINK_LIBRARIES
  LibA LibB
)

Petr


On 14 December 2017 at 03:19, Saad Khattak  wrote:

> Thanks Craig for your reply.
>
> The issue is that both "LibA" and "LibB" have been set using
> "add_library(LibA STATIC IMPORTED)" and "add_library(LibB IMPORTED)" and
> both have some properties that are being set.
>
> Ultimately, CMake recognizes LibA and LibB as CMake library projects, and
> they have their own include and link directories and other library
> dependencies.
>
> The nice thing about using LibA directly is then LibD inherits all the
> include and link directories of LibA and LibB which then get inherited by
> any library or executable that includes LibD (and ultimately, the whole
> point of modern CMake):
>
> set_target_properties(LibD
>   PROPERTIES
> IMPORTED_LINK_INTERFACE_LIBRARIES LibA #cmake recognizes LibA as
> IMPORTED CMake libraries
> )
>
> If I use "LibA;LibB" then first, I have to manually extract the library
> names of the imported CMake libraries LibA and LibB. Then, I have to call
> "target_include_directories" and "target_link_libraries" for all
> dependencies of LibA and LibB, even though these dependencies were defined
> in their own respective CMake files when calling "add_library(LibA STATIC
> IMPORTED)"
>
> set_target_properties(LibD
>   PROPERTIES
> IMPORTED_LINK_INTERFACE_LIBRARIES "LibA;LibB" #cmake no longer
> recognizes LibA and LibB as IMPORTED CMake libraries
> )
>
> Regards,
> Saad
>
> On Wed, Dec 13, 2017 at 4:32 PM Craig Scott 
> wrote:
>
>> On Thu, Dec 14, 2017 at 8:22 AM, Saad Khattak 
>> wrote:
>>
>>> Hi,
>>>
>>> I have several imported libraries:
>>>
>>> LibA
>>> LibB
>>> LibC
>>>
>>> Where each imported library has been populated by (where ${LIB_NAME} is
>>> either LibA, LibB or LibC):
>>>
>>> add_library(${LIB_NAME} STATIC IMPORTED)
>>>
>>> And each library has the properties IMPORT_LOCATION_${CONFIGURATION}
>>> set properly:
>>>
>>> set_target_properties(${LIB_NAME}
>>> PROPERTIES IMPORTED_LOCATION_DEBUG # same for release
>>>"location/of/library.lib"
>>> )
>>>
>>> Now let's say I have another imported library LibD that depends on LibA
>>> and LibB such that any executable that uses LibD must also link with LibA
>>> and LibB. To do that, I use:
>>>
>>> set_target_properties(LibD
>>>   PROPERTIES
>>> IMPORTED_LINK_INTERFACE_LIBRARIES LibA LibB
>>>   )
>>>
>>
>> You probably want this instead:
>>
>> set_target_properties(LibD
>>   PROPERTIES
>> IMPORTED_LINK_INTERFACE_LIBRARIES "LibA;LibB"
>> )
>>
>>
>> Note that if the property value is a list, you have to provide it as a
>> single string (i.e. "LibA;LibB" rather than LibA LibB)
>>
>>
>>
>> --
>> Craig Scott
>> Melbourne, Australia
>> https://crascit.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
>
-- 

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] Hard to do if in Macro

2018-01-30 Thread Petr Kmoch
Macros aren't functions, and macro parameters aren't CMake variables.
Expanding a macro parameter is effectively *textual* substitution, whereas
dereferencing a CMake variable is a semantic one.

In other words, inside your macro, the text __ANDROID__ (when not expanded)
never refers to the macro parameter. Macro parameters "don't exist" outside
of expansion context. The `if(__ANDROID__)` bit therefore always refers to
the variable __ANDROID__, never to the macro parameter __ANDROID__.

You still don't have to spell out the conditional as explicitly as you're
doing it now, but you have to expand the parameter:

macro(test __ANDROID__)
  if(${__ANDROID__})
message( "Included. " )
  endif()
endmacro()

This is what the evaluation will look like based on how you call it:

test(__ANDROID__)   -> if(__ANDROID__) -> refers to the variable
set(__ANDROID__ 1)
test(${__ANDROID__})   -> if(1)
set(__ANDROID__ 0)
test(${__ANDROID__})   -> if(0)
test(OFF)   -> if(OFF)

CMake macros have a lot of specific and potentially weird/counterintuitive
behaviour. In general, you should always write your commands as functions
and only resort to macros if you explicitly need their specific behaviour.

Petr



On 30 January 2018 at 09:11, J Decker  wrote:

> Why do I have to do
>
> if( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
> endif( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
>
> in a macro like...
> --
>
> set( __ANDROID__ 1 )
>
> macro( test __ANDROID__ )
>
>   if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
> message( "Included. " )
>   endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>
>   if( __ANDROID__ )
> message( "ALWAYS Included ${__ANDROID__}" )
>   endif( __ANDROID__ )
>
> endmacro( test )
>
> test( __ANDROID__ )
> test( ${__ANDROID__} )
> test( OFF )
>
> --
> Output
>
> Included.
> ALWAYS Included __ANDROID__
> Included.
> ALWAYS Included 1
> ALWAYS Included OFF
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Hard to do if in Macro

2018-01-31 Thread Petr Kmoch
When returning values from a function, you have to use the PARENT_SCOPE
argument of set():

function( test __ANDROID__ RETVAL )

  if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
set( ${RETVAL} ${${RETVAL}} qwer2 PASRENT_SCOPE)
message( "Included. " )
  endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")

  if( __ANDROID__ )
set( ${RETVAL} ${${RETVAL}} asdf PARENT_SCOPE)
message( "ALWAYS Included ${__ANDROID__}" )
  endif( __ANDROID__ )

endfunction( test )

Petr


On 30 January 2018 at 17:07, J Decker  wrote:

> Okay... but then with function I can't set external variables; but if(
> __ANDROID__ ) works.
>
> `result` never changes.
>
> ---
>
> set( __ANDROID__ 1 )
>
> function( test __ANDROID__ RETVAL )
>
>   if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
> set( ${RETVAL} ${${RETVAL}} qwer2 )
> message( "Included. " )
>   endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>
>   if( __ANDROID__ )
> set( ${RETVAL} ${${RETVAL}} asdf )
> message( "ALWAYS Included ${__ANDROID__}" )
>   endif( __ANDROID__ )
>
> endfunction( test )
>
>
> set( result "default" )
>
> test( __ANDROID__ "result" )
> message( "REsult:${result}" )
>
> test( ${__ANDROID__} "result" )
> message( "REsult:${result}" )
>
> test( OFF  "result")
> message( "REsult:${result}" )
>
> ---
>
>
>
>
> On Tue, Jan 30, 2018 at 12:35 AM, Petr Kmoch  wrote:
>
>> Macros aren't functions, and macro parameters aren't CMake variables.
>> Expanding a macro parameter is effectively *textual* substitution, whereas
>> dereferencing a CMake variable is a semantic one.
>>
>> In other words, inside your macro, the text __ANDROID__ (when not
>> expanded) never refers to the macro parameter. Macro parameters "don't
>> exist" outside of expansion context. The `if(__ANDROID__)` bit therefore
>> always refers to the variable __ANDROID__, never to the macro parameter
>> __ANDROID__.
>>
>> You still don't have to spell out the conditional as explicitly as you're
>> doing it now, but you have to expand the parameter:
>>
>> macro(test __ANDROID__)
>>   if(${__ANDROID__})
>> message( "Included. " )
>>   endif()
>> endmacro()
>>
>> This is what the evaluation will look like based on how you call it:
>>
>> test(__ANDROID__)   -> if(__ANDROID__) -> refers to the variable
>> set(__ANDROID__ 1)
>> test(${__ANDROID__})   -> if(1)
>> set(__ANDROID__ 0)
>> test(${__ANDROID__})   -> if(0)
>> test(OFF)   -> if(OFF)
>>
>> CMake macros have a lot of specific and potentially
>> weird/counterintuitive behaviour. In general, you should always write your
>> commands as functions and only resort to macros if you explicitly need
>> their specific behaviour.
>>
>> Petr
>>
>>
>>
>> On 30 January 2018 at 09:11, J Decker  wrote:
>>
>>> Why do I have to do
>>>
>>> if( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
>>> endif( ${M__ANDROID__} EQUAL 1 OR ${M__ANDROID__} STREQUAL "ON")
>>>
>>> in a macro like...
>>> --
>>>
>>> set( __ANDROID__ 1 )
>>>
>>> macro( test __ANDROID__ )
>>>
>>>   if( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>>> message( "Included. " )
>>>   endif( ${__ANDROID__} EQUAL 1 OR ${__ANDROID__} STREQUAL "ON")
>>>
>>>   if( __ANDROID__ )
>>> message( "ALWAYS Included ${__ANDROID__}" )
>>>   endif( __ANDROID__ )
>>>
>>> endmacro( test )
>>>
>>> test( __ANDROID__ )
>>> test( ${__ANDROID__} )
>>> test( OFF )
>>>
>>> --
>>> Output
>>>
>>> Included.
>>> ALWAYS Included __ANDROID__
>>> Included.
>>> ALWAYS Included 1
>>> ALWAYS Included OFF
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more
>>> information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://cmake.org/mailman/listinfo/cmake
>>>
>>>
>>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] use analyze with visual studio

2018-04-11 Thread Petr Kmoch
Hi,

I've never used the CL feature, but as far as CMake syntax is concerned, I
believe you're looking for this:

target_compile_options(const PRIVATE /analyze /analyze:plugin
EspXEngine.dll)

Petr

On 11 April 2018 at 00:23, Tiago Macarios  wrote:

> I am trying to pass the analyze flags to cl.exe, but I cannot figure out
> how to get it working, example:
>
> cmake_minimum_required (VERSION 2.8.11)
> set (CMAKE_VERBOSE_MAKEFILE ON)
> project (cppcore)
> add_executable (const const.cpp)
> target_compile_options (const analyze -analyze:plugin EspXEngine.dll)
>
> how to have cmake to respect that last line? I tried adding quotes, but
> that seems not to work
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] using ExternalProject_Add when cmake is launched

2018-05-02 Thread Petr Kmoch
Hi Stephane.

ExternalProject is designed to run at *build* time, not at *CMake* time. It
is not really intended for mixing with normal, non-ExternalProject targets
(such as those created by add_library).

When using ExternalProject, the canonical form of operation is a
SuperBuild-style project: your master CMakeLists.txt will contain only
ExternalProject_Add() calls, *including one for your normal project.* Your
normal project becomes just another project managed by the SuperBuild. The
SuperBuild's purpose is to download, configure, build, etc., all the
subprojects. So you generate the SuperBuild and then build it once to get
all the dependencies in place. The you switch to using just the YourProject
"child" of the SuperBuild and do normal development there.

I think googling "CMake ExternalProject_Add superbuild" will give you
enough details to get you going.

Petr

On 2 May 2018 at 10:31, Stéphane Ancelot  wrote:

> include(ExternalProject)
>
> ExternalProject_Add(
> WIN32DEPSV2
> PREFIX ${CMAKE_CURRENT_BINARY_DIR}/WIN32DEPSV2
> DOWNLOAD_DIR .
> STAMP_DIR ./stamps
> SOURCE_DIR   WIN32DEPSV2
> GIT_REPOSITORY g...@numagit.numalliance.com:THIRD_PARTIES/WIN32DEPS.git
> CONFIGURE_COMMAND ""
> BUILD_COMMAND ""
> BUILD_IN_SOURCE 1
> INSTALL_COMMAND ""
> )
>
> add_library(your_other_target ...)
>
> add_dependencies(your_other_target WIN32DEPSV2)
>
> find_package(Freetype REQUIRED QUIET)
>
> Launching cmake does not clone the git folder , but continues and fails
> with the find_package command
>
> CMake Error at /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/
> Modules/FindPackageHandleStandardArgs.cmake:137 (message):
>   Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
> Call Stack (most recent call first):
>   /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/
> FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
>   
> /usr/local/cmake-3.10.3-Linux-x86_64/share/cmake-3.10/Modules/FindFreetype.cmake:157
> (find_package_handle_standard_args)
>   FOX64/CMakeLists.txt:919 (find_package)
>
> Le 02/05/2018 à 09:32, Kai Wolf a écrit :
>
> You probably need to manually add a dependency from your ExternalProject
> to your target that needs the libraries.
> For instance
>
> ExternalProject_Add(fetch_win32_libs ...)
> add_library(your_other_target ...)
>
>
> Greetings
>
> Kai Wolf
>
> http://kai-wolf.me/
> kai.w...@gmail.com
>
> 2018-05-02 8:47 GMT+02:00 Stéphane Ancelot :
>
>> Hi,
>>
>> I have got some win32 libraries dependencies stored in a project .
>>
>> Then I added ExternalProject_Add at beginning of my cmakelists file in
>> order to clone this dependency to be available.
>>
>> and then provide the root path as follow:
>>
>> SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/JPEGLIB/jpegsrc-9c
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/zlib-1.2.3-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/libpng-1.2.37-lib
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/ftgl-binary
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/freetype-dev_2.4.2-1
>> ${CMAKE_CURRENT_SOURCE_DIR}/WIN32DEPS/iconv-1.9.2.1
>> )
>>
>>
>> unfortunately, the project is not cloned when cmake is launched and the
>> next dependencies don't find the packages :-(
>>
>> What Can I do ?
>>
>> Regards,
>>
>> S.Ancelot
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

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
CMak

Re: [CMake] WIN32_EXECUTABLE property with generator expression

2018-05-13 Thread Petr Kmoch
Hi Surya.

Generator expressions are not supported universally in CMake; only some
properties support them, and they are all documented as doing so.
WIN32_EXECUTABLE does not support genexes.

As for a workaround, you could create two executable targets, one which
would only be built in Release and one which would be built in other
configurations. Properties such as EXCLUDE_FROM_ALL and
EXCLUDE_FROM_DEFAULT_BUILD_ might come in handy.

However, I find the whole concept somewhat strange. Why is your executable
so fundamentally different between Release and other configurations?
Perhaps there is a different way of achieving your actual goal, without a
need for this.

Petr

On 13 May 2018 at 13:12, Surya Kiran Gullapalli <
suryakiran.gullapa...@gmail.com> wrote:

> With Cmake-3.11.1 and Visual Studio 2017 generator, I'm trying to set
> WIN32_EXECUTABLE property on executable only for release mode with
> generator expression like this
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE $)
>
> The generator expression doesn't seem to be working as I see
> /SUBSYSTEM:CONSOLE link flag for both Debug and Release configurations.
>
> set_target_properties(target PROPERTIES WIN32_EXECUTABLE 1)  is working
> though.
>
> Please help.
> Thanks,
> Surya
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] CMake custom target doesn't build

2018-05-14 Thread Petr Kmoch
Hi Gil.

The DEPENDS argument of add_custom_target() is for specifying dependency
*files*, not *targets*.

As the docs (
https://cmake.org/cmake/help/latest/command/add_custom_target.html) say,
what you need is add_dependencies().

Also note that you can add the COMMAND directly to the custom target, no
need for a post-build step:

add_custom_target(final_tgt ALL

  COMMAND  ARGS 

)
add_dependencies(final_tgt tgt1 tgt2)

This way, the custom target will depend on tgt1 and tgt2, and thus only
build (run its command) after they're up to date.

Petr

On 14 May 2018 at 15:22, Gil Moses  wrote:

>
>
>
>
> Hi,
>
> I’m posting this after getting no useful reply in StackOverflow:
> https://stackoverflow.com/questions/50198141/cmake-
> custom-target-doesnt-build.
>
>
>
> Using CMake 2.8.8, I'm building two targets using:
>
> add_library(tgt1 SHARED a.cpp)
>
> add_library(tgt2 SHARED b.cpp)
>
> After both are built, I need to run a post build step that depends on both
> targets. I tried many combinations of the following but with no success:
>
> add_custom_target(final_tgt DEPENDS tgt1 tgt2)
>
> add_custom_command(TARGET final_tgt POST_BUILD COMMAND  ARGS
> )
>
> The final target would simply not build, even though its build.make
> contains the custom command.
>
> Tried to use ALL for the custom target, however make attempts to build it
> first while missing the first targets.
>
> And I can't use an add_library or add_executable for the final target,
> since they require specifying source files.
>
> What is the correct way to do it?
>
> ===
>
> Edit: below is a minimal verifiable source code. What it attempts to do is
> to compile code (for Mac) in two architectures and as a post-build to
> create a universal binary using lipo:
>
> cmake_minimum_required(VERSION 2.8)
>
> set(icpc_req_path "/usr/local/bin/icpc-16.0.146")
>
>
>
> set(CMAKE_CXX_COMPILER "${icpc_req_path}")
>
>
>
> project("CMakeTest")
>
> set(SOURCE_FILES a.cpp)
>
>
>
> set (TARGET_NAME "TGT")
>
> set(TARGETS "")
>
> set(ARCHITECTURES i386 x86_64)
>
>
>
> foreach(ar ${ARCHITECTURES})
>
> set(CMAKE_CXX_FLAGS_RELEASE "")
>
> set(CMAKE_CXX_FLAGS_DEBUG "")
>
> set(CMAKE_CXX_FLAGS "")
>
>
>
> add_library(TGT_${ar} SHARED ${SOURCE_FILES})
>
> set_target_properties(${TARGET_NAME}_${ar} PROPERTIES COMPILE_FLAGS
> "-arch ${ar} -xSSE3")
>
> set_target_properties(${TARGET_NAME}_${ar} PROPERTIES LINK_FLAGS
> "-arch ${ar}")
>
> set(TARGETS "${TARGETS};lib${TARGET_NAME}_${ar}.dylib")
>
> endforeach(ar)
>
>
>
> message("Targets: ${TARGETS}")
>
> add_custom_target(${TARGET_NAME} DEPENDS ${TARGETS})
>
> add_custom_command(TARGET ${TARGET_NAME} POST_BUILD COMMAND "lipo" ARGS
> "-create" ${TARGETS} "-output" "${TARGET_NAME}.dylib")
>
>
>
> And the contents of a.cpp is:
>
> int main(){}
>
>
>
> Thanks,
>
> Gil.
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] How to Compile with -municode for MinGW-w64

2018-05-30 Thread Petr Kmoch
Hi R0b0t1,

add_definitions() is for adding preprocessor macro definitions (-D
options), not for general compilation options such as -m. You should set
the options as compilation options instead, using target_compile_options.
Also, -mwindows should probably not be passed directly; instead, use
CMake's built-in WIN32 argument in add_executable. Overall, it would look
like this:

include_directories (
  "${CMAKE_CURRENT_SOURCE_DIR}"
)

add_executable (
  mtktool
  WIN32
  mtktool.c
)

target_compile_options(
  mtktool PRIVATE -municode
)


Petr

On 30 May 2018 at 04:33, R0b0t1  wrote:

> Hello,
>
> I pass -municode in add_definitions but GCC still complains about the
> wrong type on WinMain, citing it needs an LPSTR argument. With
> -municode set it should require a LPWSTR and should be named wWinMain.
> If I name the function wWinMain the linker complains about a missing
> WinMain, which makes no sense. This works when I create a Makefile
> myself.
>
> CMakeLists.txt as follows.
>
> cmake_minimum_required (VERSION 3.5)
> project (mtktool)
>
> list (
>   APPEND
>   CMAKE_MODULE_PATH
>   "${CMAKE_CURRENT_LIST_DIR}/cmake"
> )
>
> set (mtktool_VERSION_MAJOR 0)
> set (mtktool_VERSION_MINOR 0)
> set (mtktool_VERSION_PATCH 0)
>
> configure_file (
>   "${PROJECT_SOURCE_DIR}/config.h.in"
>   "${PROJECT_SOURCE_DIR}/config.h"
> )
>
> include_directories (
>   "${CMAKE_CURRENT_SOURCE_DIR}"
> )
>
> add_definitions (
>   -municode
>   -mwindows
> )
>
> add_executable (
>   mtktool
>   mtktool.c
> )
>
> Cheers,
>  R0b0t1
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] cpp macro

2018-06-04 Thread Petr Kmoch
On 4 June 2018 at 10:16, Eric Noulard  wrote:

>
>
> In both cases I don't know how to discover that in a cross-platform way.
> Probably MSVC has another option for pre-processsing.
>

The basic option is /P, with related options /EP and /C which control line
numbering, comment suppression etc.

Petr


On 4 June 2018 at 10:16, Eric Noulard  wrote:

>
>
> Le lun. 4 juin 2018 à 09:59, Stéphane Ancelot 
> a écrit :
>
>> hi
>>
>> is there a mactro for cpp ?
>>
>
> You mean a CMake variable which would contain the path to C preprocessor
> binary?
>
> I don't think so, at list no xxx__xxx variable seems to exists for
> that.
> Did you check "cmake --help-variable-list" ?
>
> May be you can ask the compiler to act a the C pre-processor?
>
> clang and gcc both accept the '-E' command line option to only run the
> preprocessor.
>
> otherwise you may probably call
>
> find_program(C_PREPROCESSOR NAMES cpp)
>
> In both cases I don't know how to discover that in a cross-platform way.
> Probably MSVC has another option for pre-processsing.
>
> Eric
>
>>
>> Regards,
>>
>> S.Ancelot
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/
>> opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>>
>
>
> --
> Eric
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] compiling for both python2 and python3

2018-06-22 Thread Petr Kmoch
Hi Alexander.

No time for a full answer now, but a hint: it's possible to
add_subdirectory() the same CMakeLists.txt multiple times, if you use a
different binary dir each time. You can set some variables in the parent
CMakeList and use them in the child one to generate slightly different
projects from the same source.

Petr

On 22 June 2018 at 10:33, Alexander Bürger  wrote:

> Hi,
>
> I am trying to find a good way to compile a python module for a c++
> library using boost-python for both python2 and python3 in the same
> compilation. So far, The only solution I found for using
>
> FIND_PACKAGE(PythonInterp REQUIRED)
> FIND_PACKAGE(PythonLibs REQUIRED)
> FIND_PACKAGE(Boost REQUIRED COMPONENTS python # or python3)
>
> with different python versions is to use one CMakeLists.txt per python
> version, each in a subdirectory, and with almost equal contents. I would
> appreciate suggestions for a better approach, with less duplication.
>
> Best regards,
>
> Alexander Bürger
> MET Norway
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] how to deprecate a target?

2018-07-02 Thread Petr Kmoch
Hi Bram.

Wild idea: could you also define a non-namespaced target `foo` and craft it
such that linking against it generates a linker warning? Something like
"Warning: symbol `Using_just_foo_is_deprecated_use_Foo_foo_instead` defined
twice, ignoring weak definition."

Petr

On 2 July 2018 at 00:11, Bram de Greve  wrote:

> That is unfortunate ... do you know any not-so-nice ways?
>
> So, what would you recommend here?
>
> I'm deprecating the old ways to use the Foo package (using Foo_LIBRARIES
> and Foo_INCLUDE_DIRS. You know, the cmake 2.x way of things). I can do that
> nicely with variable watches.
>
> But what about the target names?  If I want to guarantee a seamless
> transition period, I should opt to keep using the "foo" target names.  But
> then there's no way to "upgrade" to "Foo::foo" targets without breakage,
> since there's no deprecation strategy. And I can't use target aliases,
> since that is not allowed on imported targets.
>
> To answer my own question, I think the best thing is to move to the
> "Foo::foo" targets right now.  There's at least one downstream package that
> will be hurt by this, but the damage is less than waiting for everyone to
> have moved to the "foo" target first.
>
> Best,
>
> Bram.
>
>
>
> On 6/29/2018 20:22, Robert Maynard wrote:
>
>> I am not aware of a nice way to setup CMake to error out if a user
>> links to `foo` instead of `Foo::foo`.
>> On Fri, Jun 29, 2018 at 2:05 AM Bram de Greve  wrote:
>>
>>> Hi all,
>>>
>>> Consider this situation.  I'm building a Foo packaged, to be used by a
>>> Bar project.
>>>
>>> Foo used to export its target as simply foo.
>>> Now it exports its target as Foo::foo.
>>>
>>> Bar contains this:
>>> add_library(bar ...)
>>> target_link_libraries(bar foo)
>>>
>>> This of course must now be:
>>> add_library(bar ...)
>>> target_link_libraries(bar Foo::foo)
>>>
>>> But if bar still links to the foo instead of Foo::foo, then CMake
>>> doesn't really complain.  foo doesn't exist, but configures and
>>> generates just fine.  Of course, you'll face strange build errors, from
>>> which it isn't immediately apparent what's causing this ...
>>>
>>> How can I make sure CMake will complain loudly when bar still links to
>>> foo?
>>>
>>> Thanks,
>>> Bram.
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Kitware offers various services to support the CMake community. For more
>>> information on each offering, please visit:
>>>
>>> CMake Support: http://cmake.org/cmake/help/support.html
>>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://cmake.org/mailman/listinfo/cmake
>>>
>>
> --
>
> 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/opensou
> rce/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] CMake, Visual Studio, do not generate absolute paths

2018-07-03 Thread Petr Kmoch
I was going to suggest SUBST as well.

However, note that CMake doesn't need to be installed using a
system-recognised installer, you can just unzip a distribution anywhere you
do have write access. In all seriousness, Visual Studio is a much more
dangerous program than CMake will ever be, as it (= VS) allows you to run
arbitrary code.

Petr

On 3 July 2018 at 09:33, Jano Svitok  wrote:

> Can you create the tree on the machine 1 so it looks the same as on
> machine 2 and thus the absolute paths would be the same?
> For example
> - by using SUBST to create virtual drive at the source root,
> - by creating whole virtual machine on machine 1
>
> https://docs.microsoft.com/en-us/windows-server/administration/windows-
> commands/subst
>
> Jano
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Adding a target to 'all' that was previously excluded

2018-07-04 Thread Petr Kmoch
Hi Andrew.

All that the EXCLUDE_FROM_ALL argument of add_executable() does is set that
target's property EXCLUDE_FROM_ALL to TRUE. So all you need to do is set
that property to false again:

  set_property(TARGET blah PROPERTY EXCLUDE_FROM_ALL FALSE)

Petr

On 4 July 2018 at 08:48, Marc CHEVRIER  wrote:

> You can use a new target, built by all, depending on your initial target:
>
> add_custom_target(build_blah_X ALL)
> add_dependencies(build_blah_X blah_X)
>
>
> Le mer. 4 juil. 2018 à 03:33, Andrew White  a
> écrit :
>
>> How do I add an excluded (executable) target to the build.  I know that
>> if I add a library EXCLUDE_FROM_ALL and then create a dependency on that
>> library then that the library will be built anyway.  How do I trigger
>> similar behaviour from an executable target?
>>
>> Example:
>>
>> Directory A contains a CMakeLists.txt that builds half a dozen
>> utilities. As part of my project, I want to add a single target from that
>> list.
>>
>> I can include the build info without auto-adding all targets by going:
>>
>> Add_subdirectory(blah EXCLUDE_FROM_ALL)
>>
>> How do I then add target blah_X to my 'all' build?  Or is there another
>> way to approach this?
>>
>> Thanks
>>
>> --
>> Andrew
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at:
>> http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more
>> information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/
>> opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Is cmake failed with any Error message?

2018-08-23 Thread Petr Kmoch
Hi Maomao.

The output includes this line:

  Configuring incomplete, errors occurred!

This means that indeed, CMake has failed to configure the project. Which
means no Makefile (or oher buildsystem) was generated and therefore the
project cannot be built.

A successful run of CMake ends with output like this:

  Configuring done
  Generating done
  Build files have been written to ...

Petr

On Mon, 13 Aug 2018 at 09:13, maomao  wrote:

> Dear admin,
>
> I am trying to build a project that is a open source and have a package on
> the website.
> The required binaries are installed by macports on my macbook pro with
> OSX10.13.6 (High Sierra).
> When I tried to cmake the project, I got the output message as:
>
> es2039:build maomao$ cmake ..
>
> -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
>
> -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS
> OpenMP_CXX_LIB_NAMES)
>
> -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
>
> -- HDF5: Using hdf5 compiler wrapper to determine C configuration
>
> CMake Error at /opt/local/share/cmake-3.12/Modules/UseSWIG.cmake:509
> (message):
>
>   SWIG_ADD_LIBRARY: python;quakelib.i: unexpected arguments
>
> Call Stack (most recent call first):
>
>   quakelib/python/CMakeLists.txt:10 (SWIG_ADD_LIBRARY)
>
>
>
> -- Configuring incomplete, errors occurred!
>
> See also "/Users/maomao/VirtualTaiwan/build/CMakeFiles/CMakeOutput.log".
>
> and failed when I proceeded to make.
> So, the question is:
> Is the project configured or not with any error message like that?
> What kind output should I see when I succeed to configure the project by
> cmake?
> If cmake is failed to configure project, the code could not be build by
> make anyway?
>
> Best,
> Maomao
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Best practice for configuration-dependent defaults?

2018-08-23 Thread Petr Kmoch
Hi Sam,

it seems to me that your user-facing option is not actually Boolean, but
tri-state: On vs. Off vs. Use_default. So I would represent it accordingly:
present the user with a string variable (with suitable STRINGS property
https://cmake.org/cmake/help/latest/prop_cache/STRINGS.html), and then
control my internal CMake logic like this:

if(FOO STREQUAL "USE_DEFAULT")
  # ...
elseif(FOO)
  # user turned FOO on
else()
  # user turned FOO off
endif()

Petr

On Fri, 17 Aug 2018 at 19:18, Sam Edwards  wrote:

> Hi all!
>
> I have a project with some options that have different defaults depending
> on the configuration used to build the project. For example, support for a
> certain (easy to support, but relatively uncommon) file format should be on
> by default, except when building in the MinSizeRel configuration. Or
> inclusion of a certain optional troubleshooting feature should be on by
> default only when building for Debug, and should default to off in all
> other configurations.
>
> For single-configuration generators, this is pretty easy: I just look at
> the CMAKE_BUILD_TYPE variable and switch the option() defaults depending on
> the selected build type, then generate my config.h once.
>
> I'm trying to support multi-configuration now. My current plan is to
> generate one config.h per build configuration (e.g. include/Debug/config.h,
> include/MinSizeRel/config.h, ...) so that the options which the user hasn't
> explicitly set can have different per-configuration values depending on
> their per-configuration defaults.
>
> However, where I'm getting stuck is in changing the default for an option
> and having that default take precedence when the user hasn't overridden the
> option explicitly. I can't just do something like:
> option(FOO "This is foo" ON)
> message("FOO is ${FOO}")
> option(FOO "This is foo" OFF)
> message("FOO is ${FOO}")
>
> ...because the first option(FOO ...) sets it to ON when it sees it isn't
> in cache and isn't selected by the user, so the second option(FOO ...)
> thinks it's already been set explicitly. Unless there's some way of
> distinguishing "ON because it's the default" from "ON because the user
> explicitly requested it" while having everything still show up correctly in
> the GUI, this won't work.
>
> Is this really the best practice for what I'm trying to do, or is there a
> better "CMake way" to do this? How do you folks solve this problem in your
> own projects?
>
> Thanks,
> Sam
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Using ExternalProject with find_library and find_path

2018-08-24 Thread Petr Kmoch
Hi Alex,

the standard solution to this is to use a Superbuild approach, in which the
top-level CMakeList contains *only* ExternalProject calls. That means your
actual project becomes just another "external" project in this superbuild,
which allows you set up all build dependencies etc. as necessary. Then, you
proceed like this:

* First generate and build the Superbuild
* Then switch to your real project within the superbuild infrastructure,
and do all further development there. You're guaranteed all your
dependencies are already available by them having been built as part of the
Superbuild step above.

Googling for "CMake ExternalProject superbuild" should give you more info.

Petr

On Fri, 24 Aug 2018 at 12:06, Alexander Dahl  wrote:

> Hei hei,
>
> for a standalone build without system libraries I was experimenting
> with the ExternalProject module today. My goal is to have some top
> level build project which includes several CMake projects and some
> external projects without relying on dev libraries installed on the
> system (reason are basically incompatible library versions). However
> those CMake projects should not be altered and should also be capable
> of building against dev libs from the system or in a cross compile
> environment like ptxdist. I created a simple example project to build
> OpenSSL with the ExternalProject module, and link either that or the
> OpenSSL lib from the system:
>
> https://github.com/LeSpocky/effective-succotash
>
> (Note: using MD5 inside this example program is really just a very
> simple example, the real application will use more of OpenSSL, so that
> one is really needed, please no suggestions for alternatives. ;-) )
>
> (Also note: some things were inspired by the FindOpenSSL.cmake coming
> with CMake 3.9).
>
> This works in general with one minor flaw. When building OpenSSL as
> external project, I have to run the build twice, because find_library
> and find_path obviously fail to find OpenSSL in the build tree before
> it is built. I could set those paths by hand with a priori knowledge
> were the OpenSSL build will put its output, but that seems like an
> unelegant solution to me.
>
> Any hints on that topic? What I found on the web was basically things
> from several years ago, I would appreciate a more modern CMake
> approach with imported targets. ;-)
>
> Greets
> Alex
>
> --
> /"\ ASCII RIBBON | »With the first link, the chain is forged. The first
> \ / CAMPAIGN | speech censured, the first thought forbidden, the
>  X  AGAINST  | first freedom denied, chains us all irrevocably.«
> / \ HTML MAIL| (Jean-Luc Picard, quoting Judge Aaron Satie)
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] CMake specify using either NVCC or host compilers with add_executable

2018-08-27 Thread Petr Kmoch
Hi Quang,

I believe this should be doable with setting the source file's LANGUAGE
property ( https://cmake.org/cmake/help/latest/prop_sf/LANGUAGE.html ):

add_executable(foo_cuda foo.cpp)
set_property(SOURCE foo.cpp PROPERTY LANGUAGE CUDA)

Petr

On Mon, 27 Aug 2018 at 17:40, Quang Ha  wrote:

> Hi all,
>
> With the new way CMake is treating CUDA codes, now we can do:
>
> project(foo LANGUAGES CXX CUDA)
>
> and can do:
>
> add_executable(foo_cuda foo.cu) # will use NVCC
> add_executable(foo_cpp foo.cpp) # will use host compilers
>
> Now since CUDA can take *.cpp files as extension (see
> https://stackoverflow.com/questions/26208784/cuda-cpp-files), is there a
> away to flip the compiler using one single source files? Something along
> the line of:
>
> if(CUDA_FOUND)
>   add_executable_with_nvcc(foo_cuda foo.cpp) # of course this doesn't exist
> else(CUDA_FOUND)
>   add_executable_with_cpp(foo_cpp foo.cpp) # neither does this
> endif(CUDA_FOUND)
>
> Or would anyone suggest a work-around? With the help of add_definitions, I
> can manually compile a host and device executable - just need to integrate
> this final step into the project.
>
> Thanks,
> Quang
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Find parent of ${PROJECT_SOURCE_DIR}

2018-08-28 Thread Petr Kmoch
Hi,

can you elaborate on how the commands you've shown "don't work?" What do
they do and how does it differ from what you need?

Petr

On Tue, 28 Aug 2018 at 08:33, Ke Gao  wrote:

> Hi,
>
> I tried different way of using GET_FILENAME_COMPONENT to find the parent
> path of PROJECT_SOURCE_DIR, or another path relative to the parent of
> PROJECT_SOURCE_DIR, never succeeded.
>
> Can anybody help, thank you very much.
>
> None of the following works. I'm using Cmake 2.8.12
> GET_FILENAME_COMPONENT(SRC_DIR ${PROJECT_SOURCE_DIR}/../source/ PATH)
> GET_FILENAME_COMPONENT(SRC_DIR ${PROJECT_SOURCE_DIR}/../source/ ABSOLUTE)
> GET_FILENAME_COMPONENT(ANA_ROOT_DIR ${PROJECT_SOURCE_DIR} ABSOLUTE)
> --
>
> ..
> Ke Gao
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] target_compile_flags and PUBLIC

2018-10-09 Thread Petr Kmoch
 Hi John,

you could put those flags as PUBLIC into a separate INTERFACE target (let's
call it hpxFlags) and then do

  target_libraries(hpx PRIVATE hpxFlags)

Then create another interface target hpxForTests to combine those two
targets:

  target_link_libraries(hpxForTests PUBLIC hpx hpxFlags)

And then link all the tests to hpxForTests instead of to hpx.

Petr


On Tue, 9 Oct 2018 at 09:48, Biddiscombe, John A.  wrote:

> I have a problem with exported flags from a project.
>
> If I use `target_compile_options(hpx PUBLIC ${flags})` hpx is compiled
> with the flags, and all 500+ tests within the project that depend on hpx
> inherit the flags too, so they get built correctly. However, the
> `HPXTargets.cmake` file that is generated with the exported targets, also
> inherits these flags and lists them in INTERFACE_COMPILE_OPTIONS, so now
> users are complaining that flags used to compile hpx are being passed onto
> their project and some of the stuff we use like `-Werror=sign-compare`
> causes a build fail in their project. If I use `target_compile_options(hpx
> PRIVATE ${flags})` then the flags are not passed on to the user projects,
> but also not passed on to the tests either. Is there an easy way of saying,
> pass these flags to all my projects within this 'PROJECT' but don't export
> them via the PUBLIC/INTERFACE to 3rd party users?
>
> Thanks
>
> JB
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] Can an option enforce a default, even if cache is present?

2018-11-28 Thread Petr Kmoch
On Tue, 27 Nov 2018 at 21:42, frodak  wrote:

> On Tue, Nov 27, 2018 at 3:15 PM Mario Emmenlauer 
> wrote:
> >
> > On 27.11.18 17:13, Eric Noulard wrote:
> > > Le mar. 27 nov. 2018 à 14:50, Mario Emmenlauer  > > > a écrit :
> > > Dear all,
> > >
> > > I've just discovered that option() behaves differently than I
> anticipated.
> > > After reading the docs and searching with google I'm still
> confused how to
> > > achieve my desired behaviour.
> > >
> > > What I've just learned is that unspecified options take their
> cached value
> > > and do *not* go back to their default value, if a cache exists. I
> assumed
> > > that options take their default when not explicitly specified.
> > >
> > >
> > > The behavior of option() gained new behavior in CMake 3.13.
> > > May be it could help in your particular case:
> > > https://cmake.org/cmake/help/v3.13/policy/CMP0077.html#policy:CMP0077
> > >
> > > you'll depend on latest CMake though.
> > >
> > >
> > > Now my problem: I could not find a way to get the behaviour I'd
> like. Is it
> > > possible to enforce the default for an option when its not
> specified by the
> > > user, even if a cache exists?
> > >
> > >
> > > You mean you did not manage to force the cache value?
> > > You can:
> > > set(VAR "default_value" CACHE FORCE)
> > >
> > > or the problem is you cannot know whether if a value has been
> user-provided?
> >
> > Sorry, I was not very precise! Your last point is the problem. I fail to
> know
> > when the option was user-provided and when it was cache-provided.
> >
> > So here is what I'd like:
> >
> > #> grep MYOPT CMakeLists.txt
> > option(MYOPT "Description" OFF)
> > #> cmake  # I want the option disabled, this works fine.
> > #> cmake -DMYOPT=ON   # I want the option enabled, this works fine.
> > #> cmake  # I want the option disabled (back to default),
> ># but I observe the option taken from cache,
> enabled.
> >
> > Is there some way to achieve my desired behaviour? I tried without
> success
> > unset(MYOPT), unset(MYOPT CACHE), and set(MYOPT OFF) before option(), but
> > they all lead to different behaviour.
> >
>

You're forgetting one important aspect of CMake: that it can retrigger
itself when a CMake source file changes. Such a run of CMake is
indistinguishable from running it manually, and it's (a large part of) why
the cache exists in the first place. Imagine the following scenario:

User runs >cmake -DMYOPT=ON
User edits a CMakeLists.txt (or even just a file processed by
configure_file()).
User runs >make

As part of this make, CMake triggers to regenerate the buildsystem. If
MYOPT exhibited the behaviour you request, it would silently get disabled
again, even though this is most definitely not what the user expects. I
addressed a similar point in this StackOverflow answer:
https://stackoverflow.com/a/41361741/1782465

Petr


>
> I've always used 'cmake -UMYOPT'  to remove specific items from the
> cache (or edit the cache file directly).
> I don't think the notion of user-provided or cache-provided entries
> exist because all user defined variables go into the cache.
> Then you can test to see if MYOPT is set and then use the default
> value when recreating the cache entry.
> Also cmake cache variables are persistent between invocations so the
> user doesn't need to keep specifying them at the command line every
> time cmake needs to run.
>
> Best regards...
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


Re: [CMake] install files generator expression

2019-01-09 Thread Petr Kmoch
Hi Lars.

The DESTINATION parameter of install() accepts only a single argument,
which means it's tripping on the line break between the two genexes. Make
it one argument:

INSTALL(FILES ${qt5_locations}
  DESTINATION
$<$:bin>$<$:lib>
  COMPONENT runtime)

This should work.

Petr


On Wed, 9 Jan 2019 at 12:29, Lars  wrote:

> Hello,
>
> We use find_package command in config mode to find Qt 5.11 libraries. The
> libraries are available as imported (Qt5::Core etc).
>
> Our understand is that CMake does not support install of imported targets.
> Therefore we use get_target_property to find actual location of library and
> Install(Files ...) to install the files.
>
> The install command looks like this (and works);
> INSTALL(FILES ${qt5_locations} DESTINATION "bin" COMPONENT runtime)
>
> The documentation states that DESTINATION supports generator expression.
> We would like to use generator expression to install libraries in "bin" on
> Windows and "lib" on Linux but have not be able to accomplish this task.
> The below command generated the following error message "Install files
> given unknown argument  $<$:lib>". We have tried other
> variants but none of them work.
>
> INSTALL(FILES ${qt5_locations}
>   DESTINATION
> $<$:bin>
> $<$:lib>
>   COMPONENT runtime)
>
> Appreicate any input.
>
> kind regards, Lars
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

Powered by www.kitware.com

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

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

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

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

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


<    1   2   3