CMake Cross Platform C++ Deployment

What is the best way to deploy c++ applications that includes third party libs? I am trying to deploy a program to Windows and Linux with the libraries SDL2 and Boost. Should I be including the headers in an include directory in the project and the lib/DLL in a lib folder?

My goal is to be able to use CMake to generate project files to create executables and then be able to distribute those workable executables to audiences from those two platforms without any additional work from them.

Here is my current CMake build without the SDL2 dependency since I'm still trying to figure out how I should implement SDL2 distribution:

1
2
3
4
5
6
7
8
9
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(--snake)

FIND_PACKAGE(Boost 1.40 COMPONENTS program_options REQUIRED)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})

ADD_EXECUTABLE(main src/main.cpp)
TARGET_LINK_LIBRARIES(main ${Boost_LIBRARIES})
INSTALL(TARGETS main DESTINATION bin)


My small source file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <SDL2/SDL.h>

#include <iostream>
#include <cstdlib>
#include "boost/program_options.hpp"

namespace po = boost::program_options;

int main(int argc, char* argv[])
{
  po::options_description desc( "Options" );
  desc.add_options()
    ("help", "print help text")
    ;

  po::variables_map vm;

  try{
    po::store(po::parse_command_line(argc,argv,desc),vm);
    if( vm.count("help") )
    {
	std::cout << desc << std::endl;
	exit( EXIT_SUCCESS );
    }
    po::notify(vm);
  }
  catch(po::error &e )
    {
      //std::cerr << "Error: " e.what() << std::endl;
      exit( EXIT_FAILURE );
    }
  exit( EXIT_SUCCESS );
}


Removing the SDL header I can run the command: cmake . -DCMAKE_INSTALL_PREFIX=install/
at the root directory of the project which works on Linux but I am positive this will not generate a portable executable for running on Windows.

Any recommendations, links to resources, or advice on how to proceed would be greatly appreciated, thank you.
Topic archived. No new replies allowed.