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

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 somethin

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

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,

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, suc

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 Do

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(VERSIO

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 20

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 Ja

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 d

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) A

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 a

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: > H

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 necessar

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 the

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 outp

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

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 (=

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,

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

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. Pe

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 CMak

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 targe

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

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: yo

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

Re: [CMake] Hard to do if in Macro

2018-01-31 Thread Petr Kmoch
message( "ALWAYS Included ${__ANDROID__}" ) > endif( __ANDROID__ ) > > endfunction( test ) > > > set( result "default" ) > > test( __ANDROID__ "result" ) > message( "REsult:${result}" ) > > test( ${__ANDROID__} "result"

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 p

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

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 dir

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

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/late

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_

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 direc

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.

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

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

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 -

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 $)

[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 followi

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 *li

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

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. P

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) #... endfunc

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 ENABL

Re: [CMake] trouble with find_package

2016-08-24 Thread Petr Kmoch
tion is, how do I get my keyboard to give me straight quotes > when I am typing. Any ideas? > Many thanks for your help. > Aaron > > On Wed, Aug 24, 2016 at 5:21 PM, Petr Kmoch wrote: > >> Hi. >> >> In your e-mail, there are curly quotes in the set() command. Is t

Re: [CMake] trouble with find_package

2016-08-24 Thread Petr Kmoch
Hi. In your e-mail, there are curly quotes in the set() command. Is that an artifact of e-mailing, or are they actually present in your code? The latter could indeed cause the error you're seeing. Petr On 24 August 2016 at 17:09, Cotton Candy wrote: > Hi, > Cmake was having trouble finding the

Re: [CMake] What is a utility target ?

2016-08-12 Thread Petr Kmoch
Hi all, a bit late to the party, but in case it's still relevant: targets have a property named TYPE ( https://cmake.org/cmake/help/latest/prop_tgt/TYPE.html ) which stores the target type as a string: get_property(type TARGET TargetName PROPERTY TYPE) if(type STREQUAL "EXECUTABLE" OR type MATCHE

Re: [CMake] CMake generator executable variable

2016-06-22 Thread Petr Kmoch
Hi Patrick. If the "subproject" is also CMake-generated, as you say, the best way to build it would be: add_custom_target(build-app COMMAND ${CMAKE_COMMAND} --build #... other options as appropriate ) You might also have to set the WORKING_DIRECTORY. This should give you a generator-agnos

Re: [CMake] help with OBJECT libraries hierarchy

2016-06-22 Thread Petr Kmoch
Ahoj Miro, object libraries are not intended for linking. The way it works is you expand the $ genex into the list of *sources* of the consuming target. In other words, the string '$' needs to go into the add_executable(foo) or add_library(foo) command, not into target_link_libraries(foo). Petr

Re: [CMake] Boost directories are not added to solution file

2016-06-10 Thread Petr Kmoch
Hi David. Probably something in your CMakeList is set up incorrectly. If you share that CMakeList, someone might be able to tell what. Petr On 10 June 2016 at 13:09, Xi Shen wrote: > I created a simple command line tool on Windows, using the Boost library. > I use the CMake tool to generate th

Re: [CMake] Build-system dependency (as opposed to target)

2016-06-09 Thread Petr Kmoch
Hi James, I believe you're looking for the directory property CMAKE_CONFIGURE_DEPENDS ( https://cmake.org/cmake/help/latest/prop_dir/CMAKE_CONFIGURE_DEPENDS.html ). Adding a file path to that property causes any changes to that file to trigger a regeneration: set_property(DIRECTORY APPEND PROPE

Re: [CMake] Build a program and get its output during "cmake" run

2016-06-07 Thread Petr Kmoch
Hi Yaron, I believe you're looking for CMake's try_run() command: https://cmake.org/cmake/help/latest/command/try_run.html Petr On 7 June 2016 at 09:15, Yaron Cohen-Tal wrote: > Hi, > > I'd like to build a C++ program and get its output during "cmake" run, not > during the project build. "CHEC

Re: [CMake] execute short program during cmake configuration ?

2016-06-03 Thread Petr Kmoch
Hi Miro, looks like you want to use the try_run() command ( https://cmake.org/cmake/help/latest/command/try_run.html ). Petr On 2 June 2016 at 22:10, Ilias Miroslav wrote: > > Greetings, dear experts, > > > we have (two) short Fortran programs (detection of integer*4/8 for math > libraries) wh

Re: [CMake] Setting a value in a sub-project

2016-05-20 Thread Petr Kmoch
The situation already involves a cache variable, though: `option(abc "cmt" ON)` is just syntactic sugar for `set(abc ON CACHE BOOL "cmt")`. Petr On 20 May 2016 at 13:03, Jakob van Bethlehem wrote: > You don't have to create a cache variable for this. Put yourself in the > position of CMake; > *

Re: [CMake] Setting a value in a sub-project

2016-05-20 Thread Petr Kmoch
Hi Doug, your syntax for `set()` in Foo is incorrect; you're actually setting a non-cache variable OPT1 do the value "ON;FORCE". You want to set the *cache* variable OPT1, which would be done like this: set(OPT1 ON CACHE BOOL "Set to OFF|ON (default is OFF) to control build of Bar library" FOR

Re: [CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-22 Thread Petr Kmoch
TW, please keep the mailing list in copy when replying. Petr On 22 April 2016 at 10:02, Chaos Zhang wrote: > So what you mean is the target have not been complied and linked after i > introduce > custom commands into this target right? Do i understand right? > > Thanks a lot for

Re: [CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-22 Thread Petr Kmoch
Hi, the reason is that the post-build command is actually a part of building "main the target." Once you introduce custom commands into a target, building it includes them all, and not just compiling the object files and linking the binary. You will notice that the "Linking C exectuable main" line

Re: [CMake] using cmake to link header files: file could be found, is included, but build error when using nmake.

2016-03-31 Thread Petr Kmoch
Hi Karel, I've noticed a few points where you could start looking for a solution: * You're mentioning that CMake warns about some linking stuff, but the compiler error is one about including a header file. Libraries and headers are fundamentally different objects: header files are used by the com

Re: [CMake] File names with unbalanced square brackets

2016-03-19 Thread Petr Kmoch
Hi Allen. I'm not sure whether it's documented, but CMake interprets square brackets as escaping the semi-colon character (which means a semi-colon in square brackets will not work as a list item separator). You will probably have to translate the file names for CMake processing by replacing [ and

Re: [CMake] target_link_libraries from executable

2016-03-10 Thread Petr Kmoch
Hi Gilles, I don't think you can get rid of this .lib, which is the import library. Linking in the .exe/.dll world does not use the .exe or .dll file itself as the item to be linked against, but its import library (.lib) instead. You cannot link against a .dll if you only have the .dll, you need i

Re: [CMake] empty list evaluates to false?

2016-02-29 Thread Petr Kmoch
Hi Jan. No, that's not possible. Internally, CMake does not differentiate between "list" and "string" in any way. An empty list and an empty string are indistinguishable. A non-empty string containing N semi-colons is indistinguishable from a list containing N+1 elements. Quantum mechanics has wa

Re: [CMake] cpack generator variable

2016-02-28 Thread Petr Kmoch
Hi Tiago. If you happen to know the directory for each configuration at CMake configure time, you could do this: install(DIRECTORY path/to/Debug/dir DESTINATION bin CONFIGURATIONS Debug COMPONENT files ) install(DIRECTORY path/to/Release/dir DESTINATION bin CONFIGURATIONS Release COM

Re: [CMake] ExternalProject_Add with flexible install commands

2016-02-25 Thread Petr Kmoch
Hi Kent, I believe it's not "empty quotes" that disables the install command, it's the empty string. So you should not escape the quotes: ### # Default behavior is to NOT install library, empty quotes should disable install set( libxxx_inst_comm INSTALL_COMMAND "" ) # Build t

Re: [CMake] CheckFortranSourceCompiles alternative for cmake 2.8.12

2016-02-23 Thread Petr Kmoch
Hi Victor, have a look at the try_compile() command ( https://cmake.org/cmake/help/v2.8.12/cmake.html#command:try_compile ), especially the second signature (the one which takes SOURCES). Petr On Tue, Feb 23, 2016 at 11:56 AM, victor sv wrote: > Hi all, > > I've seen that in CMake 3.0 appeared

Re: [CMake] Can't get CMake to use an import library generated from a MODULE target

2016-02-18 Thread Petr Kmoch
Then I would suggest something like if(CYGWIN) set(libType SHARED) else() set(libType MODULE) endif() add_library(TheProblematicOne ${libType} ...) Petr On Thu, Feb 18, 2016 at 9:59 AM, Sam Habiel wrote: > https://cmake.org/cmake/help/v3.0/command/add_library.html > > The module library (

Re: [CMake] compiler independent compiler flags

2016-02-17 Thread Petr Kmoch
Hi. There is certainly room for providing more, but BUILD_TYPE is not the only option settable in a compiler-agnostic way. There are target properties: C_STANDARD CXX_STANDARD INCLUDE_DIRECTORIES INTERPROCEDURAL_OPTIMIZATION POSITION_INDEPENDENT_CODE WIN32_EXECUTABLE and maybe more (I do not cla

Re: [CMake] Build for x86 architecture through CMake

2016-02-11 Thread Petr Kmoch
Hi Nikita, x86 is the default. If you use a plain -G "Visual Studio 14 2015" generator without any architecture, it will generate for x86. Petr On Thu, Feb 11, 2016 at 10:34 AM, Nikita Barawade < nikita.baraw...@einfochips.com> wrote: > > > Hi, > > My project needs visual studio solution for x8

Re: [CMake] cmake env - no command given

2016-02-08 Thread Petr Kmoch
Hi Lars. No, that's a "bug" in your command-line. In cmd, the caret ^ is used as a general escape character for escaping spaces, pipes etc. But to escape quotes, a backslash \ is used (yes, the escaping rules in cmd are weird). So the backslash preceding the quote is taken by cmd to be an escape c

Re: [CMake] Find correct boost among peers

2016-02-08 Thread Petr Kmoch
Hi Scott. Regarding the delimiters: you'd see them if you included the dereference in the quotes: "Boost root: ${BOOST_ROOT}". When outside quotes, the delimiters are effectively swallowed up by message(). Regarding the main issue: I could be wrong, but from a quick glance at the FindBoost.cmake

Re: [CMake] Help for a cmake newbie

2016-02-03 Thread Petr Kmoch
Hi Vadtec. *The* standard CMake way of dealing with building your dependencies is the ExternalProject module ( https://cmake.org/cmake/help/latest/module/ExternalProject.html ). It's a huge beast, but I belive there are some examples and tutorials available out there. The gist is: you create a to

Re: [CMake] Execute command after project generation

2016-02-03 Thread Petr Kmoch
Hi Nicolas. Last time I asked for something like that, it was rejected: http://public.kitware.com/Bug/view.php?id=13020 But maybe the stance could change on that? After all, I don't think CMake would want to cater for every possible postprocessing anyone needs. Perhaps it could be considered if a

Re: [CMake] errors with add_custom_command and add_custom_target

2016-01-26 Thread Petr Kmoch
e source dir and not the build dir ? > Vania > > > > On 01/26/2016 09:43 AM, Petr Kmoch wrote: > >> Hi, Vania. >> >> You should remove this line: >> >> set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED ) >> >> CMake will mark the files as gene

Re: [CMake] errors with add_custom_command and add_custom_target

2016-01-26 Thread Petr Kmoch
Hi, Vania. You should remove this line: set_property(SOURCE ${GEN_SOURCES} PROPERTY GENERATED ) CMake will mark the files as generated automatically. What your line is actually doing is setting them as *not* generated, because you didn't pass any argument to set the property to, so it's implici

Re: [CMake] add_library object argument question

2016-01-25 Thread Petr Kmoch
Hi, the name given after the : in the TARGET_OBJECTS generator expression is the logical (CMake) name of a target. There's no scoping in target names, they're all at the same global scope. So if you have this: add_library(A OBJECT ...) then you will access its objects like this: add_library(...

Re: [CMake] How to pass a configuration file to CMake?

2016-01-21 Thread Petr Kmoch
ssage because I thought a file was > required to the command 'cmake -C'. > > Do you have any idea of what I am doing wrong here? > > - Petr Kmoch a écrit : > > > Hi Cedric. > > I believe the comment string argument is mandatory in a set(... CACHE), so >

Re: [CMake] How to pass a configuration file to CMake?

2016-01-21 Thread Petr Kmoch
a > file, not a directory. > > > Do you know how to solve this problem? > > - Cedric Doucet a écrit : > > > > Hi Peter! > > Thank you very much! > It seems to be exactly what I want. :) > I will try to use it. > > Cédric > > --

Re: [CMake] Adding definitions to compile one file ?

2016-01-21 Thread Petr Kmoch
r to CMake docs for more details. Petr > > Vania > > On 01/21/2016 03:21 PM, Petr Kmoch wrote: > >> Hi Vania. >> >> For your case, it's best to forget about the >> not-as-convenient-as-they-could-be convenience functions set_*_properties, >&g

Re: [CMake] Adding definitions to compile one file ?

2016-01-21 Thread Petr Kmoch
Hi Vania. For your case, it's best to forget about the not-as-convenient-as-they-could-be convenience functions set_*_properties, and just invoke set_property: set_property( SOURCE source.cpp PROPERTY COMPILE_DEFINITIONS VAR1=${MY_VAR1} VAR2=${MY_VAR2} ) Petr On Thu, Jan 21, 2016 at 3:1

Re: [CMake] finding if feature is supported by host

2016-01-14 Thread Petr Kmoch
Hi Vania. A quick look a CMake docs will show you CMake's try_compile() command: https://cmake.org/cmake/help/latest/command/try_compile.html (There is also a try_run(), if required). I believe that's precisely what you want. Petr On Thu, Jan 14, 2016 at 5:44 PM, Vania Joloboff wrote: > Hi >

Re: [CMake] using macros

2016-01-14 Thread Petr Kmoch
Hi Owen. As a sanity check, the definition of the macro in the toplevel CMakeList comes *before* the add_subdirectory() command for the one which errors out, right? Petr On Thu, Jan 14, 2016 at 8:25 AM, Owen Hogarth II wrote: > I am trying to use a macro to enable c99 in some of my cmake modul

Re: [CMake] change add_executable to add_library leads to an error

2015-12-23 Thread Petr Kmoch
Hi Cedric. add_custom_target() does not work the way you think it does. The arguments given after the target name are commands which the custom target will execute. So what your custom target `statphys` does is execute a program named `simol-statphys`. When `simol-statphys` was the name of an exec

Re: [CMake] How to pass a configuration file to CMake?

2015-12-21 Thread Petr Kmoch
Hi Cedric. I have never used it myself, but I believe you're looking for CMake's command-line option '-C ': https://cmake.org/cmake/help/latest/manual/cmake.1.html Petr On Mon, Dec 21, 2015 at 1:12 PM, Cedric Doucet wrote: > > Hello, > > I would like to know if it's possible to pass a configur

Re: [CMake] transitive dependencies (again)

2015-12-14 Thread Petr Kmoch
Hi Tom, linking the static archive into the DLL should not be done by add_dependencies(), but by target_link_libraries(). There, you can explicitly list the archive as PRIVATE so that it does not become a part of the linking interface of the DLL: add_library(staticArchive STATIC ...) add_library

Re: [CMake] CMake target_link_libraries items should be quoted or not? Linux/Ubuntu 14.04 cmake 3.4.1

2015-12-10 Thread Petr Kmoch
Hi, yes, that is indeed expected behaviour. target_link_libraries() takes a CMake list of arguments - one library per argument. When you surround the thing with quotes, it's a single argument (containing some spaces). So for this call: target_link_libraries(Debug "${VTK_LIBRARIES} -lsri-spatialff

Re: [CMake] [cmake-developers] Obtaining header file dependencies of a source file manually

2015-11-30 Thread Petr Kmoch
On Mon, Nov 30, 2015 at 2:04 PM, iosif neitzke < iosif.neitzke+cm...@gmail.com> wrote: > What does output_required_files() [0] do, and is it applicable here? > > [0] https://cmake.org/cmake/help/v3.4/command/output_required_files.html First and foremost, it introduces deprecated behaviour into y

Re: [CMake] [cmake-developers] Obtaining header file dependencies of a source file manually

2015-11-30 Thread Petr Kmoch
Hi Dan, you could look into the IMPLICIT_DEPENDS argument of add_custom_command: https://cmake.org/cmake/help/latest/command/add_custom_command.html I don't have direct experience with it, but it looks like it could do what you're looking for. Petr On Sun, Nov 29, 2015 at 10:47 AM, Dan Liew wr

Re: [CMake] Visual Studio .sln post generate modifications?

2015-11-27 Thread Petr Kmoch
Hi. I don't know how exactly the Deploy checkbox value is stored inside the .sln file, but CMake has built-in ways of adding arbitrary sections and contents to the .sln file; see directory properties VS_GLOBAL_SECTION_PRE_ ( https://cmake.org/cmake/help/latest/prop_dir/VS_GLOBAL_SECTION_PRE_sectio

Re: [CMake] find module configuration not found

2015-11-03 Thread Petr Kmoch
Hi Owen, the find module which comes with CMake is called FindOpenGL, and is supposed to be used as: find_package(OpenGL ...) Note the case. From the error messages, it seems you're calling find_package(OPENGL). This could work on a case-insensitive system (which I believe Mac OS X uses by defau

Re: [CMake] C++11 flag not being added

2015-10-16 Thread Petr Kmoch
Hi Petr. You're using a feature (`CMAKE_CXX_STANDARD`) introduced in CMake version 3.1, so you should require a minimum version >= that. You can learn the version of CMake by running `cmake --version` Petr On Thu, Oct 15, 2015 at 5:45 PM, Petr Bena wrote: > What do you mean by "target" proper

Re: [CMake] "Pre-configure" step in CMake

2015-09-23 Thread Petr Kmoch
Hi Matthaus, do you need the pre-configure step to happen at build time? Would it be an option for you to use file(WRITE) instead of configure_file(), and execute_process() instead of add_custom_target()? Basically, perform the pre-configure step as part of the first CMake run itself. Alternative

Re: [CMake] How to do that w/o LOCATION property of a target...

2015-09-05 Thread Petr Kmoch
Hi Alex. I don't know if there is a better solution, but the following workaround should work for you: In your normal CMakeList, do `file(GENERATE OUTPUT location.cmake CONTENT "set(TheLocation \"$\")\n")`. Then, in the configured *.cmake script, do `include(location.cmake)`. The location of the

Re: [CMake] No-op command?

2015-09-02 Thread Petr Kmoch
Hi Philip. You don't need one. This is a perfectly valid piece of CMake code: if(CMAKE_SYSTEM_NAME STREQUAL "Windows") else() ... do something ... endif() Of course, the comment can be put in there, but you don't need any commands between an if() and else() (or between any other pair of start-

Re: [CMake] ExternalProject git clone hangs on windows

2015-08-17 Thread Petr Kmoch
Hi Avi. On Sat, Aug 15, 2015 at 1:54 AM, Tevet, Avi A wrote: > Hi all, > > > [...] > > > > I don’t know if this is related, but when I look inside the generated VS > projects for the dependencies, I see the “CMake Rules” directory full of > *.rule files, but they are all effectively empty, conta

Re: [CMake] Possible to dynamically construct macro/function names to invoke?

2015-08-10 Thread Petr Kmoch
Hi, Eric. On Mon, Jul 20, 2015 at 12:52 AM, Eric Wing wrote: > I would like to dynamically construct a macro or function name to > invoke. I basically have a core CMake system I want users to be able > to extend/plug stuff into without knowing about a lot of the core > CMake implementation. Call

Re: [CMake] config-specific compiler definitions don't work properly

2015-07-17 Thread Petr Kmoch
Hi. Looking at the documentation ( http://www.cmake.org/cmake/help/v3.3/manual/cmake-properties.7.html#properties-on-directories , http://www.cmake.org/cmake/help/v3.3/manual/cmake-properties.7.html#properties-on-targets ), you will find that neither the directory property nor the target property

Re: [CMake] Finding internal libraries

2015-07-13 Thread Petr Kmoch
Hi John. I have no first-hand experience with it, but I believe the ExternalProject module could be just what you're looking for ( http://www.cmake.org/cmake/help/v3.2/module/ExternalProject.html ). It allows you to configure and build several projects at build time under a CMake "superbuild" mast

Re: [CMake] cmake: Duplicate file name conflict

2015-07-08 Thread Petr Kmoch
aders} > resources/${PROJECT_NAME}.qrc ${Sources}) > target_link_libraries(${PROJECT_NAME} library) > > I hope that helps understanding my problem. Since the content of > sameName.h and sameName.cpp of the library is different from those of the > application it doesn't

Re: [CMake] cmake: Duplicate file name conflict

2015-07-08 Thread Petr Kmoch
Hi Jan, it'simpossible to answer such questions without seeing your setup. Can you post your CMakeList and your directory structure? Petr On Tue, Jul 7, 2015 at 6:36 PM, Jan Steinke wrote: > Dear all, > I came across a problem, for me it seems that cmake does not allow header > files to be hav

Re: [CMake] Recursively include target include directories only

2015-06-17 Thread Petr Kmoch
On Thu, Jun 18, 2015 at 1:43 AM, Robert Dailey wrote: > On Wed, Jun 17, 2015 at 4:31 PM, Dan Liew wrote: > > On 17 June 2015 at 12:28, Robert Dailey > wrote: > >> Is there a way to only take (recursively) the include directiories from > >> a target or set of targets? I know that include directo

  1   2   3   >