Author Topic: How to set linker options for compiler file using source code  (Read 12343 times)

Offline pramaykaruley

  • Single posting newcomer
  • *
  • Posts: 4
I have created new compiler.xml file and corresponding option.xml file with include and lib path in it.

I want to link external libraries to the compiler using source code, where should I put that?

For Ex: If I want to create a compiler to compile to opengl program, then I have to link -lglfw3 -lgdi32 -lopengl32 libraries

This I want to achieve with the help of source code.

Please help..

Thanks in advance!!

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: How to set linker options for compiler file using source code
« Reply #1 on: June 13, 2018, 11:49:09 pm »
Are you blind?

If no, please state a valid reason you do not wish to use the Code::Blocks GUI interface to set the libraries you wish to link?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sodev

  • Lives here!
  • ****
  • Posts: 500
Re: How to set linker options for compiler file using source code
« Reply #2 on: June 14, 2018, 01:34:07 am »
Well, it looks like he is abusing the compiler definition system to define default compiler settings to deploy them to multiple projects or installations.

This is the poor mans method if you don't use a meta-project generator like PreMake or CMake where you can achieve that by using setup-scripts you store in a central location and import them into the projects. Or if you use an IDE that doesn't have an integrated feature for that like e.g. Visual Studio with its Property Pages ;).

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7678
    • My Best Post
Re: How to set linker options for compiler file using source code
« Reply #3 on: June 14, 2018, 02:01:48 am »
Well, it looks like he is abusing the compiler definition system to define default compiler settings to deploy them to multiple projects or installations.

This is the poor mans method if you don't use a meta-project generator like PreMake or CMake where you can achieve that by using setup-scripts you store in a central location and import them into the projects. Or if you use an IDE that doesn't have an integrated feature for that like e.g. Visual Studio with its Property Pages ;).

Could CB project scripts be used to set link libraries values?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline pramaykaruley

  • Single posting newcomer
  • *
  • Posts: 4
Re: How to set linker options for compiler file using source code
« Reply #4 on: June 14, 2018, 08:11:09 am »
Are you blind?

If no, please state a valid reason you do not wish to use the Code::Blocks GUI interface to set the libraries you wish to link?

Tim S.

The configuration made by codeblocks GUI are saved locally. I want it to persist whenever I install codeblocks from a locally created .deb file

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: How to set linker options for compiler file using source code
« Reply #5 on: June 14, 2018, 08:34:35 pm »
Why?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]