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

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 (

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 >

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

2019-09-13 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,

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

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

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

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

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

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)

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

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

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

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

2018-08-24 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

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

Re: [cmake-developers] why can target_include_directories() not be applied to custom targets?

2018-07-08 Thread Petr Kmoch
Hi Drew, a custom target can do literally anything, it's just a buildsystem wrapper for running arbitrary executables; or often not even that, and is just a collection of custom commands. There is nothing CMake automatically does with the properties [INTERFACE_]INCLUDE_DIRECTORIES set on a custom

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

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

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.

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

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

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

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:

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

Re: [CMake] Hard to do if in Macro

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

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

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

Re: [cmake-developers] GCC x cmake

2017-09-20 Thread Petr Kmoch
On Tue, Sep 19, 2017 at 11:34 AM, Ivam Pretti wrote: > I would like to know what are the advantages or difference when compared >> to GCC compiler. >> >> > I understand from the topic you mean compared to cmake; but the two are > two different things > gcc is a compiler >

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

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

Re: [CMake] Question about transitive deps and static libs.

2017-04-19 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

Re: [cmake-developers] Feature suggestion: auto-create missing files

2017-04-13 Thread Petr Kmoch
OK, I can see there's quite a few voices against and none for. Idea scratched. Thanks everyone for input. 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

Re: [cmake-developers] Feature suggestion: auto-create missing files

2017-04-11 Thread Petr Kmoch
Thanks for the quick response, Brad. On 11 April 2017 at 17:52, Brad King <brad.k...@kitware.com> wrote: > On 04/11/2017 11:41 AM, Petr Kmoch wrote: > > Currently, adding a new source file to a CMake-controlled project > > means doing two things: creating the fil

[cmake-developers] Feature suggestion: auto-create missing files

2017-04-11 Thread Petr Kmoch
Hi all, I'd like to implement a feature for CMake which I miss there, and I'd like to get approval for the idea & design before proceeding. Currently, adding a new source file to a CMake-controlled project means doing two things: creating the file on disk, and adding it to the relevant CMakeList

Re: [cmake-developers] Build multiple CMake projects

2017-03-27 Thread Petr Kmoch
Hi Jerry, from your description, it seems like you might be looking for the CMake module ExternalProject: https://cmake.org/cmake/help/latest/module/ExternalProject.html The idea is that you create a "superbuild" CMake project which consists of ExternalProject_Add calls and related

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

Re: [CMake] clean custom_target

2016-10-26 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.

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

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

Re: [CMake] trouble with find_package

2016-08-25 Thread Petr Kmoch
m! > Now the question 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 <petr.km...@gmail.com> wrote: > >> Hi. >> >> In your e-mail, 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

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

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

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

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

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

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

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

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"

Re: [cmake-developers] [PATCH] cmFileCommand: sort list of files from glob command

2016-05-16 Thread Petr Kmoch
Hi all. I'd like to express my concerns about the proposed change. CMake strongly discourages using `file(GLOB)` to find source files, since file additions then do not automatically trigger a buildsystem regeneration. So well-behaved projects, which do not feed such outputs to add_*() commands,

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

2016-04-22 Thread Petr Kmoch
Thanks a lot for your generous help. :-) > > 2016-04-22 16:38 GMT+08:00 Petr Kmoch <petr.km...@gmail.com>: > >> Hi, >> >> the reason is that the post-build command is actually a part of building >> "main the target." Once you introduce custom co

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"

Re: [cmake-developers] [CMake] add_custom_command() OUTPUT does not accept generator expressions, why?

2016-04-06 Thread Petr Kmoch
On 6 April 2016 at 09:51, Yves Frederix wrote: > [...] > So, basically, a prerequisite for the above > to work is that CMake behaves nicely for the following as well: > > add_library(test_lib STATIC existing_file_$.cpp) > > At this moment CMake supports generator

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

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 [

Re: [cmake-developers] BUG: ALL_BUILD not added to the PREDEFINED_TARGETS_FOLDER

2016-03-15 Thread Petr Kmoch
Hi Taylor, I am afraid this behaviour is by design, so that ALL_BUILD can be the first target in the generated solution and thus the Startup project by default. However (speaking to the wider list audience), I would really appreciate an option to override this "by design" behaviour. For projects

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

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

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

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

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

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 >

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

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

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

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

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

Re: [CMake] errors with add_custom_command and add_custom_target

2016-01-26 Thread Petr Kmoch
lly add them in the 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 ma

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

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:

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

2016-01-21 Thread Petr Kmoch
; refer 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

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

2016-01-21 Thread Petr Kmoch
cmake" is a > file, not a directory. > > > Do you know how to solve this problem? > > - Cedric Doucet <cedric.dou...@inria.fr> a écrit : > > > > Hi Peter! > > Thank you very much! > It seems to be exactly what I want. :) > I will try to use it. &g

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

2016-01-21 Thread Petr Kmoch
am quite surprised about this message 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 <petr.km...@gmail.com> a écrit : > > > Hi Cedric. > > I believe the comment string

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

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

Re: [cmake-developers] CMake alternative language (was: Using CMake as a library from Python)

2016-01-11 Thread Petr Kmoch
Hi all. I'd like to voice my opinion as a somewhat advanced CMake user here. For me, one of the strongest points of CMake is the fact that its project specification is procedural rather than declarative. In my current job, for example, we have a significant framework built in CMake which handles

Re: [cmake-developers] Profile Cmake scripts

2016-01-05 Thread Petr Kmoch
On Tue, Jan 5, 2016 at 1:33 PM, Daniel Pfeifer wrote: > > Generators for Xcode and Visual Studio have to generate more files. > ... and they have to process all configurations (Debug, Release, MinSizeRel, RelWithDbgInfo) during the generation stage, instead of just one

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

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

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

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}

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

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

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

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

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

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

2015-09-24 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.

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-03 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

  1   2   3   4   >