Re: [CMake] Can't Generate Project Files for VS2019

2019-04-29 Thread Jano Svitok
On Sun, Apr 28, 2019 at 10:11 PM Osman Zakir 
wrote:
>
> For VS2017 I'd do "-G"Visual Studio 15 2017 Win64"".  So for VS2019 it's
"-G"Visual Studio 16 2019" -A x64"?  Kind of weird in my opinion.

Hi,

sorry for brevity, I was replying from a phone. I hope you got it working
in the mean time.

Here is documentation for MS2017:
https://cmake.org/cmake/help/v3.14/generator/Visual%20Studio%2015%202017.html#platform-selection
Note that when you specify platform within generator name, you use Win64,
but when using -A, you use x64.
For VS2019, you have to use -A with x64, no other choices.

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] Can't Generate Project Files for VS2019

2019-04-28 Thread Jano Svitok
Hi,

Use 'x64' as platform.

Jano

On Sun, Apr 28, 2019, 13:36 Osman Zakir  wrote:

> I just tried to build Step 1 of the CMake tutorial that comes with the
> source code (CMake version 3.14.3), once with VS2019 as the generator and
> then again with VS2017 as the generator.  The latter worked fine but the
> former didn't.  I got the same error as mentioned in the initial message:
>
> "
> cmake -G"Visual Studio 16 2019" -A Win64
> -DCMAKE_INSTALL_PREFIX="C:/Program Files/binaryen"
> -DCMAKE_BUILD_TYPE=Release ../
> CMake Error at CMakeLists.txt:1 (PROJECT):​
>   Failed to run MSBuild command:​
> ​
> C:/Program Files (x86)/Microsoft Visual
> Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe​
> ​
>   to get the value of VCTargetsPath:​
> ​
> Microsoft (R) Build Engine version 16.0.461+g6ff56ef63c for .NET
> Framework​
> Copyright (C) Microsoft Corporation. All rights reserved.​
> ​
> Build started 4/27/2019 5:48:57 PM.​
> Project "C:\binaryen\build\CMakeFiles\3.14.3\VCTargetsPath.vcxproj" on
> node 1 (default targets).​
> C:\Program Files (x86)\Microsoft Visual
> Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(775,5):
> error : The OutputPath property is not set for project
> 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified
> a valid combination of Configuration and Platform for this project.
> Configuration='Debug'  Platform='Win64'.  You may be seeing this message
> because you are trying to build a project without a solution file, and have
> specified a non-default Configuration or Platform that doesn't exist for
> this project. [C:\binaryen\build\CMakeFiles\3.14.3\VCTargetsPath.vcxproj]​
> Done Building Project
> "C:\binaryen\build\CMakeFiles\3.14.3\VCTargetsPath.vcxproj" (default
> targets) -- FAILED.​
> ​
> Build FAILED.​
> ​
> "C:\binaryen\build\CMakeFiles\3.14.3\VCTargetsPath.vcxproj" (default
> target) (1) ->​
> (_CheckForInvalidConfigurationAndPlatform target) ->​
>   C:\Program Files (x86)\Microsoft Visual
> Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(775,5):
> error : The OutputPath property is not set for project
> 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified
> a valid combination of Configuration and Platform for this project.
> Configuration='Debug'  Platform='Win64'.  You may be seeing this message
> because you are trying to build a project without a solution file, and have
> specified a non-default Configuration or Platform that doesn't exist for
> this project. [C:\binaryen\build\CMakeFiles\3.14.3\VCTargetsPath.vcxproj]​
> ​
> 0 Warning(s)​
> 1 Error(s)​
> ​
> Time Elapsed 00:00:00.20​
> ​
> ​
>   Exit code: 1​
> ​
> ​
> ​
> -- Configuring incomplete, errors occurred!​
> See also "C:/binaryen/build/CMakeFiles/CMakeOutput.log".
> "
>
> When I try to look at the .vcxproj file mentioned in the error, I see that
> it can't find VS2019 Build Tools even though I do have them.  I asked on
> MSDN forums but I don't have a reply there yet.  And I don't know how to
> fix the issue myself, either.
>
> I would like for someone to please help me out with this.  Is there a way
> for me to fix this problem?  Like some sort of patch that can be added
> somewhere?  I installed the binary for CMake 3.14.3 initially and only got
> the source code to try out the tutorial as a test for CMake; I'm not
> planning to try and build 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] CMake, Visual Studio, do not generate absolute paths

2018-07-03 Thread Jano Svitok
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] Link against exe on Windows fails - .a file not found

2018-05-13 Thread Jano Svitok
On Mon, May 14, 2018 at 1:34 AM, Jano Svitok <jan.svi...@gmail.com> wrote:

> ENABLE_EXPORTS does #2.
>

Note: for dlls (aka shared libraries) symbols are enabled automatically.
You need ENABLE_EXPORTS 1 only for exes.
Note2: I use MSVC, I have little experience with clang.

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] Link against exe on Windows fails - .a file not found

2018-05-13 Thread Jano Svitok
On Sun, May 13, 2018 at 1:41 PM, Michael Ho  wrote:
>
> Hey there.
>
> I'm trying to make a plugin system for my application, and thus each
plugin will need to link with my main application. This is fine on Linux
and macOS, as I can just set the ENABLE_EXPORTS property of my executable
target (set_target_properties(${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS 1),
and plugins will link just fine. On Windows however, clang++ yells at me
that it can't find libws2editor.dll.a.
>
> clang++.exe: error: no such file or directory:
'ws2editor/libws2editor.dll.a'
>
> Upon looking over the CMake docs, it says "For DLL platforms an import
library will be created for the exported symbols and then used for
linking." - This import library file (presumably the .dll.a) never seems to
be created though.
>
>
> After a bit more digging around I came across
https://github.com/Kitware/CMake/blob/master/Tests/Plugin/CMakeLists.txt -
When I clone the CMake repo and try and compile that test myself, it also
fails with the same error when using clang + ninja! When building with
MSVC/msbuild however it compiles just fine (My project fails to configure
when generating files for MSVC however, and ideally I'd like to use the
same build config across Win/Mac/Linux).
>
> So how can I get the CMake build on Windows to create this file, or
otherwise link with an executable?

You need to 1. mark some/all symbols to export 2. actually export them
ENABLE_EXPORTS does #2. For #1, you need to either mark each symbol to
export as __declspec(dllexport) or mark all symbols with
WINDOWS_EXPORT_ALL_SYMBOLS (see
https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/,
check also comments for possible drawbacks).

https://github.com/Kitware/CMake/blob/master/Tests/Plugin/include/example.h
shows how to use __declspec(dllexport): for each dll you define a macro (
EXAMPLE_EXPORT here) that becomes either export (when #included from dll)
or import (when #included from code linked to dll). Every
class/function/variable you want to use from the plugin must be marked this
way (example_exe_function). For class members, it's enough to mark the
class.
Finally there's a #define (example_exe_EXPORTS here) that controls how is
the macro defined. See
https://cmake.org/cmake/help/git-master/prop_tgt/DEFINE_SYMBOL.html (I
didn't know this until now, we used to manually define the symbol!)

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] Generating MSVS solution files that can be passed around

2018-04-19 Thread Jano Svitok
You don't have to install cmake. Just get the zip version, unzip in
somewhere along your sources and you are done.
I'm not sure whether any runtime dlls are needed, but I suppose not.

We use cmake like that. We've committed a copy in our git repo, and have a
simple means to update cmake for everyone
in the team at once.

Jano

On Thu, Apr 19, 2018 at 6:55 PM, Zaak Beekman  wrote:

> Ha, yeah that’s an option. The problem is that they’re not “my”
> contractors. They are the client’s contractors. We’ll see.
> On Thu, Apr 19, 2018 at 12:52 PM Cristian Adam 
> wrote:
>
>> On Thu, Apr 19, 2018 at 5:46 PM, Zaak Beekman  wrote:
>>
>>> The situation is that we have a client who works with other contractors
>>> who use almost exclusively windows and MSVS. This client wants to
>>> distribute MSVS solution files with the source code so that other
>>> contractors don’t have to install cmake. (There are some restrictions/red
>>> tape for installing additional software on the contractor machines…)
>>>
>>
>> Why not distribute CMake as source code? Compile it so that they don't
>> have to "install" it.
>>
>> On the other hand Visual Studio 2017 comes with their own version of
>> CMake! Just make sure your contractors use VS2017 :D
>>
>> Cheers,
>> Cristian.
>>
>>
>
> --
>
> 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] Visual C++ Compile/Link Flags

2018-02-13 Thread Jano Svitok
On Tue, Feb 13, 2018 at 2:38 PM, ThePhD  wrote:

> I have a project where I attempt to add linker flags to a Visual Studio
> project using
>
>  target_link_libraries(lib_target PRIVATE /OPT:NOREF)
>
> But it seems like the `/` syntax automatically has CMake assuming that the
> flag is a file, and it complains it cannot find the file. Is there any way
> to have CMake recognize a passed-in linker flag using this syntax? As a
> side note, is there perhaps a better way of passing in Linker flags that I
> am not aware of? Documentation stated that using "target_link_libraries" is
> preferred, and I did not find "target_link_options".
>

You can try this; I don't know if this is the preferred way to do it.

set_property( TARGET lib_target APPEND_STRING PROPERTY LINK_FLAGS "
/OPT:NOREF" )

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-developers] Cannot control the name of dependfile set in Ninja generator

2018-01-28 Thread Jano Svitok
Do as the bot says: post a comment in gitlab that says do:reformat and then
pull the branch from gitlab.

Dňa 28. 1. 2018 6:49 dopoludnia používateľ "Claus Klein" <
claus.kl...@arcormail.de> napísal:

Hi Chris,

done, but:

   - commit 4f48fef4
   

is
   not allowed because the following files are not formatted according to the
   'clang-format-3.8' check: Source/cmNinjaTargetGenerator.cxx. Post a
   comment ending in the line Do: reformat to rewrite the MR source branch
   automatically.


I have no clang-format?

Only xcode installed.
-- 

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


Re: [cmake-developers] (no subject)

2017-12-02 Thread Jano Svitok
On Sat, Dec 2, 2017 at 10:45 AM, Lectem  wrote:

> Hi,
>
>
>
> I’m hurting an issue trying to hide dependencies from files that do not
> need those.
>
> For example, I have a library that helps me decode some file, but I don’t
> want this library headers to be available for every .cpp in my library but
> one.
>
>
>
> For example what one may do is the following :
>
>
>
> #-
>
> add_library(mylib foo.cpp bar.cpp)
>
> target_link_libraries(mylib PRIVATE libonlyusefulforfoo)
>
> #-
>
>
>
> It works fine, but now bar.cpp can also include headers from
> libonlyusefulforfoo.
>
> So what I tried was to use object libraries, but it has many
> disadvantages :
>
>- I now have to duplicate dependencies for the object library and
>mylib if they have include directories requirements or compile flags in
>common
>- An object library is a target… and I don’t want to add one target
>per file that has special include directories
>- An object library shows in IDEs, while I’d like the .cpp files to
>stay in the same project. In visual the obj will be in my library but this
>is not practical.
>
> I thought about source files properties, but unfortunately they do not
> support include directories, so here is my question :
>
>
>
> *TL ;DR*
>
> Would it be possible/difficult to have a PRIVATE_INCLUDE_DIRECTORIES
> property added for source files ?
>
> We already have COMPILE_FLAGS so why not include directories ?
>
>
>
> I know we can set include directories per directory, but I don’t think
> that putting single .cpp files in seperate headers is good.
>
>
>
> Thanks,
>
> Lectem
>

Did you check these?

https://cmake.org/cmake/help/v3.10/command/target_include_directories.html
https://cmake.org/cmake/help/v3.10/command/target_sources.html

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