Re: [CMake] How can I compile and link modular code into a single DLL with MSVC?

2018-06-27 Thread Jason Heeris
On Thu, 28 Jun 2018 at 04:16, Innokentiy Alaytsev wrote: > I don't quite understand why are you using object libraries all over the project. Mainly because I tried a lot of things, and with the release of 3.12 I figured I'd try object libs again. > If those modules are not intended to be used

[CMake] Linking object libraries into a Windows DLL in 3.12rc1

2018-06-25 Thread Jason Heeris
odule1.obj" module2.vcxproj -> C:\Users\heerij\Code\cmake-dll-ex\build\modules\module2\module2.dir\Debug\module2.lib I didn't want to dump the entire MSVC output here because there's a tonne of it. But if you don't want to try this yourself, the output is here: https://gitlab.com/snippets/1

Re: [CMake] Linking object libraries into a Windows DLL in 3.12rc1

2018-06-26 Thread Jason Heeris
On Tue, Jun 26, 2018 at 7:36 PM, Deniz Bahadir wrote: Yes, you have overlooked an important detail. Only usage-requirements are transitive, the object-files are only propagated to directly dependent targets (not to indirectly dependent ones) *and only if they have a link/archive step*

[CMake] How can I compile and link modular code into a single DLL with MSVC?

2018-06-26 Thread Jason Heeris
This is a follow-on from "Linking object libraries into a Windows DLL in 3.12rc1"[1] - I figured since I'm reframing that question I should start a new thread. I have a project that has some common code and about a hundred modules. The modules can have dependencies on each other (only ever as a

Re: [CMake] How can I compile and link modular code into a single DLL with MSVC?

2018-06-27 Thread Jason Heeris
On Wed, 27 Jun 2018 at 15:00, Innokentiy Alaytsev wrote: > Do you create declspec declaration by hand? It may worth looking at the > GenerateExportHeader > > Thanks, this will probably be very useful! > Is it the code that

[CMake] How do I use install() with targets that might not be built?

2018-07-25 Thread Jason Heeris
My project consists of a lot of "module" style targets (static libraries, more or less), but only a few top-level targets that a user would actually want to build. The "all" target is empty, that is, every target has "EXCLUDE_FROM_ALL" set. The user will, at compile time, decide to build whichever

[CMake] Cannot prevent import library from being created with VS generator

2018-07-09 Thread Jason Heeris
I'm using CMake 3.12-rc1 on Windows 10. I have the following `CMakeLists.txt`: cmake_minimum_required(VERSION 3.8) project(cmake_test) unset(CMAKE_IMPORT_LIBRARY_SUFFIX) add_library(main MODULE "main.c") The generator is Visual Studio 15 2017. I would like to suppress the "/IMPLIB" argument

Re: [CMake] Cannot prevent import library from being created with VS generator

2018-07-09 Thread Jason Heeris
On Tue, 10 Jul 2018 at 09:57, J. Caleb Wherry wrote: > Side note 1: Things like this eventually lead me to have a post process (a python script) on all my VS project files to “fix” any issues like this. It might interest you to know that I've worked around it a bit by tweaking the IMPORT_PREFIX

Re: [CMake] How can I compile and link modular code into a single DLL with MSVC?

2018-06-28 Thread Jason Heeris
On Thu, 28 Jun 2018 at 20:14, Jason Heeris wrote: > So I went and tried this on the real project, and it seems like compiling the static libs into a DLL doesn't give the same results as using the obj files directly, as per my initial list of commands. Namely, some symbols seem to not be gett

Re: [CMake] How to change (and account for) default Visual Studio compiler flags

2018-06-28 Thread Jason Heeris
On Thu, 28 Jun 2018 at 15:19, Jason Heeris wrote: > 1. How do I clear default compiler flags for the Visual Studio generator? I would strongly prefer a solution that can apply to specific targets, but if not, so be it. I have created an issue about this on Gitlab: https://gitlab.kitware.

Re: [CMake] How can I compile and link modular code into a single DLL with MSVC?

2018-06-28 Thread Jason Heeris
On Thu, 28 Jun 2018 at 08:18, Jason Heeris wrote: > > If those modules are not intended to be used outside of the final shader library, then why not to make them static libraries? > I'll test it on the real thing and see how that goes. The only problem I encountered was that the fin

Re: [CMake] How to change (and account for) default Visual Studio compiler flags

2018-06-28 Thread Jason Heeris
On Thu., 28 Jun. 2018, 8:45 pm Innokentiy Alaytsev, wrote: > Are you setting CMAKE_<...> variables before creating you targets of after > that? > I used the technique in that Stackoverflow link to print and override them before anything else happens in the project. They are still empty

[CMake] How to change (and account for) default Visual Studio compiler flags

2018-06-27 Thread Jason Heeris
I'm using CMake (3.12 currently) in Windows 10 to build a DLL to be compatible with what an existing program expects. To this end, I need near-total control over the compiler and linker flags used to generate that DLL. I created a very simple project, with a single compilation unit, main.c,

Re: [CMake] How to change (and account for) default Visual Studio compiler flags

2018-06-28 Thread Jason Heeris
On Thu., 28 Jun. 2018, 6:07 pm Innokentiy Alaytsev, wrote: > These flags are visible in cmake-gui > if you set (I don't know/remember the right word) the Advanced combo box > (setting Grouped will dramatically improve readability). So after sending my last email I actually tried that; not only

[CMake] Toolchain file for TI in CMake 3.10: how do I override compiler options and specify tools?

2019-02-22 Thread Jason Heeris
I am trying to use CMake (3.10) to build an ANSI C project that may be compiled on PC with eg. GCC, but also needs to compile with Texas Instruments' compilers for their microprocessors. So I have about a million questions. According to[1] it seems like the way to do this is via a toolchain file.